GETPGRP(2)
NAME
getpgrp − get process group
USAGE
pgrp = getpgrp(pid)
int prgp;
int pid;
DESCRIPTION
Getpgrp returns the process group of the specified process. If pid is zero, then the call applies to the current process.
Process groups are used to distribute signals, and by terminals to arbitrate requests for their input: processes that have the same process group as the terminal are foreground and may read, while others will block with a signal if they attempt to read.
Programs like csh(1) use this call to create process groups in implementing job control. The TIOCGPGRP and TIOCSPGRP calls described in tty(4) are used to get or set the process group of the control terminal.
RETURN VALUE
On success, the call returns the process group of the specified process. On failure, it returns −1.