SETPGRP(2) SETPGRP(2) NAME setpgrp, BSDsetpgrp - set process group ID (System V and 4.3BSD) C SYNOPSIS #include <unistd.h> SysV: pid_t setpgrp (void); BSD: Links with the BSD version automatically: int BSDsetpgrp(int pid, int pgrp); Links with the BSD version if -lbsd is specified during link phase: int setpgrp(int pid, int pgrp); DESCRIPTION The System V version of setpgrp behaves identically to setsid (2). The BSD version of 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 pgrp is zero and pid refers to the calling process, setpgrp() behaves identically to setsid (2). If the invoker is not the super-user, then the affected process must have the same effective user-id as the invoker or be a member of the same session as the calling process. ERRORS: BSD VERSION ONLY BSDsetpgrp will fail and the process group will not be altered if one of the following occur: [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 in the same session as the calling process. [EACCES] In the Trusted IRIX environment, the Mandatory Access Control (MAC) label of the calling process is not equal to the MAC label of pid and the calling process does not have the CAP_MAC_READ and CAP_MAC_WRITE capabilities(4). SEE ALSO exec(2), fork(2), getpgrp(2), getpid(2), intro(2), kill(2), setpgid(2), setsid(2), signal(2), capabilities(4), dominance(5). DIAGNOSTICS The System V version of setpgrp returns the value of the new process group ID with no possibility of error. The BSD version returns 0 if the operation is successful. If the request fails, -1 is returned and the global variable errno is set to indicate the reason. Page 2