getpid()--Get Process ID
Syntax
#include <sys/types.h> #include <unistd.h> pid_t getpid(void);
Service Program Name: QP0WSRV1
Default Public Authority: *USE
Threadsafe: Yes
The getpid() function returns the process ID of the calling process.
Parameters
None.
Authorities
None.
Return Value
pid_t | The value returned by getpid() is the process ID of the calling process. |
Error Conditions
The getpid() function is always successful and does not return an error.
Usage Notes
The getpid() function enables a process for signals if the process is not already enabled for signals. For details, see Qp0sEnableSignals()--Enable Process for Signals.
Related Information
- The <sys/types.h> file (see Header Files for UNIX®-Type Functions)
- The <unistd.h> file (see Header
Files for UNIX-Type Functions)
- Qp0sDisableSignals()--Disable Process for
Signals
- Qp0sEnableSignals()--Enable Process for
Signals
- Qp0wGetPid()--Get Process ID
- Qp0wGetPidNoInit()--Get Process ID without Initializing for Signals
Example
For an example of using this function, see the child program in Example: Using process-related APIs.
API introduced: V3R6