int setpgid(pid_t pid, pid_t pgid);
Sets the process group ID for process pid to pgid. Returns zero on success, or the negation of the error code on failure.
getpgid, getpgrp, setsid