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, 4.3BSD, SVr4.
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.