Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
waitpid(2) OSS System Calls Reference Manual
The effect of the waitpid( ) function can be modified by the setting of the SIGCHLD signal. See
the sigaction(2) reference page for details.
The waitpid() function behaves identically to the wait() function if the process_id parameter
has the value -1 and the options parameter has the value 0 (zero). Otherwise, its behavior is
modified by the values of the process_id and options parameters.
Use From the Guardian Environment
If called from a Guardian process, the actions of this function are undefined and errno is set to
[ENOTOSS].
Specifying the Child Process
The waitpid() function allows the calling process to gather status from a specific set of child
processes. The waitpid() function returns the status of a child process from this set. The
process_id parameter specifies the set according to the following rules:
• If process_id is equal to -1, status is requested for any child process. In this respect, the
waitpid() function is equivalent to the wait() function.
• If process_id is greater than 0 (zero), it specifies the OSS process ID (PID) of a single
child process for which status is requested.
• If process_id is equal to 0 (zero), status is requested for any child process whose process
group ID is equal to that of the calling process.
• If process_id is less than -1, status is requested for any child process whose process
group ID is equal to the absolute value of process_id.
Options
The options parameter modifies the behavior of the waitpid( ) function. This parameter is con-
structed from the bitwise-inclusive OR of the following flag values:
WNOHANG Prevents the calling process from being suspended even if there are child
processes to wait for. In this case, 0 (zero) is returned, indicating that there are
no child processes that have stopped or terminated.
WUNTRACED
Returns information when child processes of the current process are stopped
because they received a SIGTTIN, SIGTTOU, SIGSTOP,orSIGTSTP signal.
Status Information
If the waitpid( ) function returns because the status of a child process is available, it returns the
OSS process ID of the child process. In this case, if the status_location parameter is not a null
pointer, information is stored in the location pointed to by status_location.
The value stored at the location pointed to by status_location is 0 (zero) if and only if the status
returned is from a terminated child process that either returned 0 (zero) from the main() function
or passed 0 (zero) as the status
parameter to the _e
xit() or exit() function.
Regardless of its value, this status information can be interpreted using the following macros,
which are defined in the sys/wait.h header file and evaluate to integer expressions:
WCOMPLETION(∗∗status_location)
Evaluates to the 16-bit Guardian completion code issued on process termination.
10−8 Hewlett-Packard Company 527186-023