man pages section 2: System Calls
  Search only this book
View this book in:
Download this book in PDF (1733 KB)

getpgrp(2)

Name | Synopsis | Description | Return Values | Errors | Attributes | See Also

Name

    getpid, getpgrp, getppid, getpgid– get process, process group, and parent process IDs

Synopsis

    #include <unistd.h>
    
    pid_t getpid(void);
    pid_t getpgrp(void);
    pid_t getppid(void);
    pid_t getpgid(pid_t pid);

Description

    The getpid() function returns the process ID of the calling process.

    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.

    ESRCH

    There is no process with a process ID equal to pid.

    The getpgid() function may fail if:

    EINVAL

    The value of the pid argument is invalid.

Attributes

    See attributes(5) for descriptions of the following attributes:

    ATTRIBUTE TYPE 

    ATTRIBUTE VALUE 

    Interface Stability 

    Standard 

    MT-Level 

    Async-Signal-Safe 

See Also

SunOS 5.10  Last Revised 28 Dec 1996

Name | Synopsis | Description | Return Values | Errors | Attributes | See Also