GETPGRP(2)GETPGRP(2)NAMEgetpgrp - get process group
BSD SYNOPSIS
#include <sys/types.h>
pid_t getpgrp(int pid);
POSIX SYNOPSIS
#include <sys/types.h>
pid_t getpgrp(void);
DESCRIPTION
The BSD version of getpgrp returns the process group ID of the process
with ID pid. If pid is 0, or if the calling application is a POSIX
application, then the process group ID of the current process is
returned.
Process groups are used for distribution of 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. Each process group
is the member of one session.
This call is thus used by programs such as csh(1) to create process
groups in implementing job control. To get/set the process group of
the controlling terminal, BSD applications use the TIOCGPGRP and
TIOCSPGRP calls described in tty(4), and POSIX applications use the
tcgetpgrp(2P) and tcsetpgrp(2P) functions.
SEE ALSOsetsid(2P), setpgid(2P), setpgrp(2), getuid(2), tcgetpgrp(2P),
tcsetpgrp(2P), tty(4)4.2 Berkeley Distribution August 1, 1992 GETPGRP(2)