getpgrp() - get process group
#include <unistd.h>
pid_t getpgrp (void)
The getpgrp(2) function returns the process group ID of the current process.
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.
The getpgrp(2) function is always successful and no return value is reserved to indicate an error.
setpgid(2)
setsid(2)