HP-UX Reference (11i v1 05/09) - 2 System Calls (vol 5)
w
wait(2) wait(2)
WIFEXITED(stat_val)
Evaluates to a non-zero value if status was returned for a child process that ter-
minated normally.
WEXITSTATUS(stat_val)
If the value of WIFEXITED(stat_val)
is non-zero, this macro evaluates to the
low-order 8 bits of the status argument that the child process passed to
_exit() or
exit(), or the value the child process returned from
main().
WIFSIGNALED(stat_val)
Evaluates to non-zero value if status was returned for a child process that terminated
due to the receipt of a signal that was not caught (see <signal.h>).
WTERMSIG(stat_val)
If the value of WIFSIGNALED(stat_val)
is non-zero, this macro evaluates to the
number of the signal that caused the termination of the child process.
WIFSTOPPED(stat_val)
Evaluates to a non-zero value if status was returned for a child process that is
currently stopped.
WSTOPSIG(stat_val)
If the value of WIFSTOPPED(stat_val)
is non-zero, this macro evaluates to the
number of the signal that caused the child process to stop.
WIFCONTINUED(stat_val)
Evaluates to a non-zero value if status was returned for a child process that has con-
tinued from a job control stop.
If the information pointed to by stat_loc was stored by a call to
waitpid() that specified the
WUN-
TRACED
flag and did not specify the WCONTINUED flag, exactly one of the macros
WIFEXITED(*stat_loc)
, WIFSIGNALED(*stat_loc), and WIFSTOPPED(*stat_loc)
will
evaluate to a non-zero value.
If the information pointed to by stat_loc was stored by a call to
waitpid() that specified the
WUN-
TRACED
and WCONTINUED flags, exactly one of the macros WIFEXITED(*stat_loc)
,
WIFSIGNALED(*stat_loc)
, WIFSTOPPED(*stat_loc), and WIFCONTINUED (*stat_loc)
will evaluate to a non-zero value.
If the information pointed to by stat_loc was stored by a call to waitpid() that did not specify the
WUN-
TRACED
or WCONTINUED flags, or by a call to the wait() function, exactly one of the macros
WIFEXITED(*stat_loc)
and WIFSIGNALED(*stat_loc) will evaluate to a non-zero value.
If the information pointed to by stat_loc was stored by a call to
waitpid() that did not specify the
WUN-
TRACED
flag and specified the WCONTINUED flag, by a call to the wait()
function, exactly one of the
macros
WIFEXITED(*stat_loc)
, WIFSIGNALED(*stat_loc), and
WIFCONTINUED(*stat_loc)
will evaluate to a non-zero value.
There may be additional implementation-dependent circumstances under which
wait() or waitpid()
report status. This will not occur unless the calling process or one of its child processes explicitly makes use
of a non-standard extension. In these cases the interpretation of the reported status is
implementation-dependent.
If a parent process terminates without waiting for all of its child processes to terminate, the remaining
child processes will be assigned a new parent process ID corresponding to an implementation-dependent
system process.
RETURN VALUE
If wait() or waitpid() returns because the status of a child process is available, these functions will
return a value equal to the process ID of the child process for which status is reported. If wait() or
waitpid() returns due to the delivery of a signal to the calling process, −1 will be returned and errno
will be set to [EINTR]. If waitpid() was invoked with WNOHANG set in options, it has at least one child
process specified by pid for which status is not available, and status is not available for any process
specified by pid, 0 will be returned. Otherwise, (pid_t)−1 will be returned, and errno will be set to indi-
cate the error.
Section 2−−472 Hewlett-Packard Company − 2 − HP-UX 11i Version 1: September 2005