Close Menu
    Facebook X (Twitter) Instagram
    Command Linux
    • About
    • How to
      • Q&A
    • OS
      • Windows
      • Arch Linux
    • AI
    • Gaming
      • Easter Eggs
    • Statistics
    • Blog
      • Featured
    • MORE
      • IP Address
      • Man Pages
    • Write For Us
    • Contact
    Command Linux
    Home - man page - GETPID

    GETPID

    WillieBy WillieMarch 30, 2026Updated:March 30, 2026No Comments1 Min Read
     

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

    NOTES

    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).
    Willie
    • Website

    Willie has over 15 years of experience in Linux system administration and DevOps. After managing infrastructure for startups and enterprises alike, he founded Command Linux to share the practical knowledge he wished he had when starting out. He oversees content strategy and contributes guides on server management, automation, and security.

    Related Posts

    PS2PDF

    April 21, 2026

    FORK

    April 21, 2026

    OPENSSL

    April 21, 2026

    C89

    April 21, 2026
    Top Posts

    OPENSSL_ia32cap

    April 1, 2026

    READDIR

    March 24, 2026

    FLOCK

    March 18, 2026

    OpenGL Download Guide

    January 23, 2026
    • Home
    • Contact Us
    • Privacy Policy
    • Terms of Use

    Type above and press Enter to search. Press Esc to cancel.