wait(5) wait(5)
NAME
wait - wait status
SYNOPSIS
#include <sys/wait.h>
DESCRIPTION
When a process waits for status from its children via either the
wait() or waitpid() function, the status returned may be evaluated
with the following macros, defined in sys/wait.h. These macros evalu-
ate to integral expressions. The stat argument to these macros is the
integer value returned from wait() or waitpid().
WIFEXITED(stat) Evaluates to a non-zero value if status was
returned for a child process that terminated
normally.
WEXITSTATUS(stat) If the value of WIFEXITED(stat) is non-zero,
this macro evaluates to the exit code that the
child process passed to exit or exit, or the
value that the child process returned from main.
WIFSIGNALED(stat) Evaluates to a non-zero value if status was
returned for a child process that terminated due
to the receipt of a signal.
WTERMSIG(stat) If the value of WIFSIGNALED(stat) is non-zero,
this macro evaluates to the number of the signal
that caused the termination of the child pro-
cess.
WIFSTOPPED(stat) Evaluates to a non-zero value if status was
returned for a child process that is currently
stopped.
WSTOPSIG(stat) If the value of WIFSTOPPED(stat) is non-zero,
this macro evaluates to the number of the signal
that caused the child process to stop.
WIFCONTINUED(stat) Evaluates to a non-zero value if status was
returned for a child process that has continued.
WCOREUMP(stat) If the value of WIFSIGNALED(stat) is non-zero,
this macro evaluates to a non-zero value if a
core image of the terminated child was created.
Page 1 Reliant UNIX 5.44 Printed 11/98
wait(5) wait(5)
The following symbolic constants for waitpid() are also defined in
wait.h:
WEXITED Wait for processes that have exited.
WSTOPPED Status will be returned for any child that has
stopped upon receipt of a signal.
WCONTINUED Status will be returned for any child that was
stopped and has been continued.
WNOWAIT Keep the process whose status is returned in
infop in a waitable state.
WNOHANG Return if no status is available.
WUNTRACED Status of stopped child process.
The type idtypet is defined as an enumeration type whose possible
values include at least the following:
PALL
PPID
PPGID
The idt type is defined as described in <sys/types.h>.
The siginfot type is defined as described in <signal.h>.
The rusage structure is defined as described in <sys/resource.h>.
The pidt type is defined as described in <sys/types.h>.
Inclusion of the <sys/wait.h> header may also make visible all symbols
from <signal.h> and <sys/resource.h>.
The following are declared as functions and may also be defined as
macros:
pidt wait(int *statloc);
pidt wait3(int *statloc, int options, struct rusage *resourceusage);
int waitid(idtypet idtype, idt id, siginfot *infop, int options);
pidt waitpid(pidt pid, int *statloc, int options);
SEE ALSO
wait(2), waitid(2), wait3(3), resource(5), types(5).
Page 2 Reliant UNIX 5.44 Printed 11/98