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 getpid system call returns the process ID of the current process. Most often it is used, with the host identifier gethostid, to generate uniquely named temporary files.
Return Values
The getppid system call returns the process ID of the parent of the current process.
Environment
POSIX
When your program is compiled in POSIX mode, the getpid and getppid functions return a value of type pid_t.