SETPGRP(2)
NAME
setpgrp − set process group
USAGE
setpgrp(pid, pgrp) int pid, pgrp;
DESCRIPTION
Setpgrp sets the process group of the specified process pid to the specified pgrp. If pid is zero, then the call applies to the current process.
If the caller is not the super-user, then the affected process must have the same effective user-ID as the caller, or must be a descendant of the calling process.
RETURN VALUE
A successful call returns zero. A failed call returns -1 and sets errno as indicated below.
ERRORS
Setpgrp fails and the process group is not altered if any of the following occurs:
[ESRCH] The requested process does not exist.
[EPERM] The effective user ID of the requested process is different from that of the caller, and the process is not a descendant of the calling process.