getpid(2freebsd)

getpid2freebsd

Get parent or calling process identification

Usage

#include <unistd.h>

pid_t

getpid(void);

pid_t

getppid(void);

Library

Standard C Library (libc, -lc)

Overview

The getpid() system call returns the process ID of the calling process. Though the ID is guaranteed to be unique, it should NOT be used for constructing temporary file names, for security reasons; see mkstemp(3) instead.

The getppid() system call returns the process ID of the parent of the calling process.

Errors

The getpid() and getppid() system calls are always successful, and no return value is reserved to indicate an error.

Releases

9 releases since Debian 5.0 (Lenny); the text changed 6 times.

  1. 5.0
  2. 6.0
  3. 7
  4. 8
  5. 9
  6. 10
  7. 11–13

Standards

The getpid() and getppid() system calls are expected to conform to ISO/IEC 9945-1:1990 (“POSIX.1”).

History

The getpid() function appeared in Version 7 AT&T UNIX.

From freebsd-manpages 12.2-2 in Debian 13 (Trixie). Parsed by carta from the page's mdoc source.