Returns the process group ID of the calling process.
Standard C Library (libc.a)
#include <unistd.h>
pid_t getpgid (Pid) (pid_ Pid)
The getpgid subroutine returns the process group ID of the process whose process ID is equal to that specified by the Pid parameter. If the value of the Pid parameter is equal to (pid_t)0, the getpgid subroutine returns the process group ID of the calling process.
Pid | The process ID of the process to return the process group ID for. |
id | The process group ID of the requested process |
-1 | Not successful and errno set to one of the following. |
ESRCH | There is no process with a process ID equal to Pid. |
EPERM | The process whose process ID is equal to Pid is not in the same session as the calling process. |
EINVAL | The value of the Pid argument is invalid. |
The exec (exec: execl, execle, execlp, execv, execve, execvp, or exect Subroutine) subroutine, fork (fork, f_fork, or vfork Subroutine) subroutine, getpid (getpid, getpgrp, or getppid Subroutine) subroutine, getsid (getsid Subroutine) subroutine, setpgid subroutine, setsid subroutine.