getpid(2)getpid(2)Name
getpid, getppid - get process identification
Syntax
#include <sys/types.h>
#include <unistd.h>
pid = getpid()
pid_t pid;
ppid = getppid()
pid_t ppid;
Description
The system call returns the process ID of the current process. Most
often it is used, with the host identifier to generate uniquely named
temporary files.
Return Values
The system call returns the process ID of the parent of the current
process.
Environment
POSIX
When your program is compiled in POSIX mode, the and functions return a
value of type pid_t.
See Alsogethostid(2)getpid(2)