[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1


getpgid Subroutine

Purpose

Returns the process group ID of the calling process.

Library

Standard C Library (libc.a)

Syntax

#include <unistd.h>

pid_t getpgid (Pid)
(pid_ Pid)

Description

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.

Parameter


Pid The process ID of the process to return the process group ID for.

Return Values


id The process group ID of the requested process
-1 Not successful and errno set to one of the following.

Error Code


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.

Related Information

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.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]