[Previous]
[Contents]
[Next]

getpid()

get the process ID

Synopsis:

#include <sys/types.h>
#include <unistd.h>
pid_t getpid( void );

Description:

The getpid() function allows the calling process to find out its identity.

Returns:

The process ID of the calling process.

Examples:

/*
 * print out the ID of this process
 */
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

void main()
  {
    printf( "I'm process %d\n", getpid() );
  }

Classification:

POSIX 1003.1

Safety:
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

getppid()


[Previous]
[Contents]
[Next]