Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

getpgid - get process group ID

&pagelevel(4)&pagelevel

Syntax

#include <unistd.h>

pid_t getpgid(pid_t pid); 

Description

getpgid() returns the process group ID of the process whose process ID is pid. If pid is 0, the process group ID of the calling process is returned.

Return val.

Process group ID


if successful.

(pid_t)-1

if an error occurs. errno is set to indicate the error.

Errors

getpgid() will fail if:

 

EPERM

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

 

ESRCH

There is no process with a process ID pid.

 

EINVAL

The value of pid is invalid.

See also

exec, fork(), getpgrp(), getpid(), getsid(), setpgid(), setsid(), unistd.h.