getpid(S)
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),
fork(S),
getsid(S),
Intro(S),
setpgid(S),
setpgrp(S),
setsid(S),
signal(M),
sigaction(S)
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.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003