getpid(2)


NAME

   getpid, getppid - get process identification

SYNOPSIS

   #include <sys/types.h>
   #include <unistd.h>

   pid_t getpid(void);
   pid_t getppid(void);

DESCRIPTION

   getpid() returns the process ID of the calling process.  (This is often
   used by routines that generate unique temporary filenames.)

   getppid() returns the process ID of the parent of the calling process.

ERRORS

   These functions are always successful.

CONFORMING TO

   POSIX.1-2001, POSIX.1-2008, 4.3BSD, SVr4.

NOTES

   If  the  caller's  parent  is  in  a  different  PID   namespace   (see
   pid_namespaces(7)), getppid() returns 0.

   C library/kernel differences
   Since  glibc  version  2.3.4,  the  glibc wrapper function for getpid()
   caches PIDs, so as to avoid additional  system  calls  when  a  process
   calls getpid() repeatedly.  Normally this caching is invisible, but its
   correct operation relies  on  support  in  the  wrapper  functions  for
   fork(2),  vfork(2),  and clone(2): if an application bypasses the glibc
   wrappers for these system calls by using syscall(2),  then  a  call  to
   getpid()  in  the  child will return the wrong value (to be precise: it
   will return the PID of the parent  process).   See  also  clone(2)  for
   discussion  of  a  case  where getpid() may return the wrong value even
   when invoking clone(2) via the glibc wrapper function.

SEE ALSO

   clone(2),   fork(2),   kill(2),   exec(3),   mkstemp(3),    tempnam(3),
   tmpfile(3), tmpnam(3), credentials(7), pid_namespaces(7)

COLOPHON

   This  page  is  part of release 4.09 of the Linux man-pages project.  A
   description of the project, information about reporting bugs,  and  the
   latest     version     of     this    page,    can    be    found    at
   https://www.kernel.org/doc/man-pages/.


More Linux Commands

manpages/mytool.1.html
mytool(1) - manipulate map files for yudit, uniconv and unip
mytool is a my map file manipulation program in the yudit distribution. It can generates so-called binary nbit ( my ) map file that can map any sequences of byt

manpages/ObjCmdWrite.3.html
ObjCmdWrite(3) - Writing C language extensions to Tcl. '....
ObjCmdWrite.3 - This document is intended to help the programmer who wishes to extend Tcl with C language routines. It should also be useful to someone wishing

manpages/clear.3ncurses.html
clear(3ncurses) - clear all or part of a curses window......
The erase and werase routines copy blanks to every position in the window, clearing the screen. The clear and wclear routines are like erase and werase, but the

manpages/SDL_SetGamma.3.html
SDL_SetGamma(3) - Sets the color gamma function for the disp
Sets the gamma function for the display of each color component. Gamma controls the brightness/contrast of colors displayed on the screen. A gamma value of 1.0

manpages/immedok.3ncurses.html
immedok(3ncurses) - curses output options - Linux man page
These routines set options that change the style of output within curses. All options are initially FALSE, unless otherwise stated. It is not necessary to turn

manpages/perlfaq.1.html
perlfaq(1) - frequently asked questions about Perl (ManPage)
The perlfaq comprises several documents that answer the most commonly asked questions about Perl and Perl programming. Its divided by topic into nine major sect

manpages/Tcl_WaitForEvent.3.html
Tcl_WaitForEvent(3) - the event queue and notifier interface
The interfaces described here are used to customize the Tcl event loop. The two most common customizations are to add new sources of events and to merge Tcls ev

manpages/Tcl_GetObjResult.3.html
Tcl_GetObjResult(3) - manipulate Tcl result - Linux man page
The procedures described here are utilities for manipulating the result value in a Tcl interpreter. The interpreter result may be either a Tcl object or a strin

manpages/gnutls_pubkey_get_key_usage.3.html
gnutls_pubkey_get_key_usage(3) - API function (Man Page)....
This function will return the key usage of the public key. RETURNS On success, GNUTLS_E_SUCCESS (0) is returned, otherwise a negative error value. SINCE 2.12.0

manpages/xgi.4.html
xgi(4) - XGI video driver (Special files - Linux man page)
xgi is an XFree86 driver for XGI video chips. The driver is accelerated, and provides support for colordepths of 8, 16 and 24 bpp. XVideo, Render and other exte

manpages/tsort.1.html
tsort(1) - perform topological sort - Linux manual page.....
Write totally ordered list consistent with the partial ordering in FILE. With no FILE, or when FILE is -, read standard input. --help display this help and exit

manpages/Tcl_RegExpGetInfo.3.html
Tcl_RegExpGetInfo(3) - Pattern matching with regular express
Tcl_RegExpMatch determines whether its pattern argument matches regexp, where regexp is interpreted as a regular expression using the rules in the re_syntax ref





We can't live, work or learn in freedom unless the software we use is free.