[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Kernel and Subsystems Technical Reference, Volume 1

getpid Kernel Service

Purpose

Gets the process ID of the current process.

Syntax

#include <sys/types.h>
#include <sys/errno.h>
pid_t getpid ()

Description

The getpid kernel service returns the process ID of the calling process.

The getpid service can also be used to check the environment that the routine is being executed in. If the caller is executing in the interrupt environment, the getpid service returns a process ID of -1. If a routine is executing in a process environment, the getpid service obtains the current process ID.

Execution Environment

The getpid kernel service can be called from either the process or interrupt environment.

Return Values

-1 Indicates that the getpid service was called from an interrupt environment.

The getpid service returns the process ID of the current process if called from a process environment.

Implementation Specifics

The getpid kernel service is part of the Base Operating System (BOS) Runtime.

Related Information

Process and Exception Management Kernel Services and Understanding Execution Environments in AIX Version 4.3 Kernel Extensions and Device Support Programming Concepts.


[ Previous | Next | Contents | Home | Search ]