Open System Services System Calls Reference Manual (G06.25+, H06.03+)
wait(2) OSS System Calls Reference Manual
NAME
wait - Waits for any child process to 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 wait(
int ∗∗status_location);
PARAMETERS
status_location Points to a location that receives the child process termination status, as defined
in the sys/wait.h header file.
DESCRIPTION
The wait() function usually suspends the calling process until one of the following occurs:
• A child process initiates its own normal termination. That is, a child process calls the
_exit() or exit() function or the Guardian STOP or PROCESS_STOP_ procedure on
itself.
• A 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.
• A child process terminates abnormally. The calling process receives a SIGABEND sig-
nal 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 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 wait() function returns without waiting if a child process that has not been waited for has
already terminated prior to the call.
The effect of the wait() function can be modified by the setting of the SIGCHLD signal. See the
sigaction(2) reference page for details.
Use With POSIX Threads
If Release Version Update (RVU) G06.21, or later, of T1248 POSIX threads is installed on the
system, the T1248 version of wait() is functionally equivalent to OSS wait(), with the additional
attribute of thread awareness. As such, it blocks only the thread calling it, without blocking any
other threads. To call the T1248 wait() function, include the linking flag -l spt when compiling
thread-aware applications. If more than one thread is waiting on child processes, use the
spt_waitpid() function.
Use From the Guardian Environment
If called from a Guardian process, the actions of this function are undefined and errno is set to
[ENOTOSS].
10−2 Hewlett-Packard Company 527186-003