Copyright 1993 Rickard E. Faith (email@example.com)
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
(The comments found at the beginning of the groff file "man2/getppid.2".)
getpid, getppid - get process identification
returns the process ID of the calling process.
(This is often used by
routines that generate unique temporary filenames.)
returns the process ID of the parent of the calling process.
These functions are always successful.
POSIX.1-2001, POSIX.1-2008, 4.3BSD, SVr4.
If the caller's parent is in a different PID namespace (see
C library/kernel differences
Since glibc version 2.3.4,
the glibc wrapper function for
so as to avoid additional system calls when a process calls
Normally this caching is invisible,
but its correct operation relies on support in the wrapper functions for
if an application bypasses the glibc wrappers for these system calls by using
then a call to
in the child will return the wrong value
(to be precise: it will return the PID of the parent process).
for discussion of a case where
may return the wrong value even when invoking
via the glibc wrapper function.
This page is part of release 4.04 of the Linux
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at