Synopsis

Description

The getpgrp() function returns the process group ID of the calling process.

The getppid() function returns the parent process ID of the calling process.

The getpgid() function returns the process group ID of the process whose
process ID is equal to pid, or the process group ID of
the calling process, if pid is equal to 0.

Return Values

Upon successful completion, these functions return the process group ID. Otherwise, getpgid()
returns (pid_t)-1 and sets errno to indicate the error.

Errors

The getpgid() function will fail if:

EPERM

The process whose process ID is equal to pid is not in the same session as the calling process, and the implementation does not allow access to the process group ID of that process from the calling process.