Fix BSD build: use setpgid() instead of setpgrp()

In BSD land, setpgrp has the same signature as setpgid (two arguments)
while everywhere else it doesn't take any arguments.
Meanwhile setpgid() is the same everywhere and setpgid(0, 0) does the
same thing as the non-BSD setpgid().
Fix Windows build