Get a process group ID
#include <unistd.h> pid_t getpgid( pid_t pid );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The getpgid() returns the group ID for the process specified by pid. If pid is 0, getpgid() returns the calling process's group ID.
The following definitions are worth mentioning:
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 |