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
Setpgrp returns zero when the operation is successful. If the request fails, −1 is returned, and the global variable errno indicates the reason.
ERRORS
Setpgrp fails and the process group is not altered if one 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.