Get a process's group ID
#include <unistd.h> pid_t getpgid( pid_t pid );
libc
The getpgid() returns the process group ID for the process specified by pid. If pid is 0, getpgid() returns the calling process's group ID.
A process group ID for success, or (pid_t)-1 if an error occurs.
If an error occurs, errno is set to:
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | No |
| Signal handler | Yes |
| Thread | Yes |
getegid(), getgid(), setpgid()