Open System Services System Calls Reference Manual (G06.25+, H06.03+)
System Functions (w) waitpid(2)
NAME
waitpid - Waits for a specific child process to stop or terminate
LIBRARY
G-series native OSS processes: system library
H-series OSS processes: implicit libraries
SYNOPSIS
#include <sys/types.h> /* optional except for POSIX.1 */
#include <sys/wait.h>
pid_t waitpid(
pid_t process_id,
int ∗∗status_location,
int options);
PARAMETERS
process_id Specifies the child process.
status_location Points to a location that receives the child process termination (or stop) status, as
defined in the sys/wait.h header file.
options Modifies the behavior of the function.
DESCRIPTION
The waitpid( ) function usually suspends the calling process until one of the following occurs:
• The specified child process initiates its own normal termination. That is, the child pro-
cess calls the _exit() or exit() function or the Guardian STOP or PROCESS_STOP_ pro-
cedure on itself.
• The child process receives a signal that terminates the process. For example, some other
process terminates the child process by calling the kill() function or the Guardian STOP
or PROCESS_STOP_ procedure against the child process.
• The child process terminates abnormally. The calling process receives a SIGABEND
signal indicating that this process or another process has called the Guardian ABEND or
PROCESS_STOP_ procedure specifying abnormal termination of the child process, or
the child process has abnormally terminated for some other reason.
• The child process was stopped (that is, suspended) by a job-control signal and the WUN-
TRACED option was set in this call to waitpid( ).
• The parent process catches a signal and invokes its own signal-catching function.
See the Guardian Procedure Calls Reference Manual for details on the Guardian ABEND,
STOP, and PROCESS_STOP_ procedures.
The waitpid( ) function returns without waiting if a child process that has not been waited for has
already stopped or terminated prior to the call.
The POSIX.1 standard states that when status information for two or more child processes is
available, the order in which the information is returned by the waitpid() function is unspecified.
HP’s implementation also does not provide this information in a reliable sequence. The
sequence should therefore not be depended upon for further processing.
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
527186-003 Hewlett-Packard Company 10−7