Get a process group ID
#include <unistd.h> pid_t getpgid( pid_t pid );
- The ID of the process whose process group ID you want to get.
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.
In order to get the group ID of a process outside the calling process's session, your process must have the PROCMGR_AID_GETID ability enabled. For more information, see procmgr_ability() .
The following definitions are worth mentioning:
- An executing instance of a program, identified by a nonnegative integer called a process ID.
- Process group
- A collection of one or more processes, with a unique process group ID. A process group ID is a positive integer.
A process group ID for success, or (pid_t)-1 if an error occurs.
If an error occurs, errno is set to:
- The calling process doesn't have the required permission; see procmgr_ability() .
- The process specified by pid doesn't exist.
Last modified: 2013-12-23