getpid(S-osr5)
getpid, getpgrp, getppid, getpgid --
get process, process group, and parent process IDs
Syntax
cc . . . -lc
#include <sys/types.h>
#include <unistd.h>
pid_t getpid(void);
pid_t getpgrp(void);
pid_t getppid(void);
pid_t getpgid(pid_t pid);
Description
getpgid gets the process whose process ID is
equal to pid, or the process group ID of the
calling process, if pid is equal to zero.
Return values
On success, getpgid returns a process group
ID. On failure, getpgid returns
(pid_t
) -1 and sets errno to identify the
error.
Diagnostics
In the following conditions, getpgid fails and sets
errno to:
[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.
Files
/lib/libc.a-
linking library
See also
exec(S-osr5),
fork(S-osr5),
getsid(S-osr5),
Intro(S-osr5),
setpgid(S-osr5),
setpgrp(S-osr5),
setsid(S-osr5),
signal(M),
sigaction(S-osr5)
Standards conformance
getpgrp, getpid and getppid conform
with:
AT&T SVID Issue 3
;
X/Open Portability Guide, Issue 3, 1989
;
Intel386 Binary Compatibility Specification, Edition 2 (iBCSe2)
;
IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1)
;
and
NIST FIPS 151-1
.
getpgid is conformant with:
AT&T SVID Issue 3.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005