WAIT(2) GENIX Programmer's Manual WAIT(2)
NAME
wait - wait for process to terminate
SYNOPSIS
wait(status)
int *status;
wait(0)
DESCRIPTION
Wait causes its caller to delay until a signal is received or one of
its child processes terminates. If any child has died since the
last wait, return is immediate; if there are no children, return is
immediate with the error bit set (resp. with a value of -1
returned). The normal return yields the process ID of the ter-
minated child. In the case of several children several wait calls
are needed to learn of all the deaths.
If (int)status is nonzero, the high byte of the word pointed to
receives the low byte of the argument of exit when the child ter-
minated. The low byte receives the termination status of the pro-
cess. See signal(2) for a list of termination statuses (signals); 0
status indicates normal termination. A special status (0177) is
returned for a stopped process which has not terminated and can be
restarted. See ptrace(2). If the 0200 bit of the termination
status is set, a core image of the process was produced by the sys-
tem.
If the parent process terminates without waiting on its children,
the initialization process (process ID = 1) inherits the children.
There is another entry wait3(2) which is provides additional options
needed by the shell csh(1) to do job control.
SEE ALSO
wait3(2), exit(2), fork(2), signal(2)
DIAGNOSTICS
Returns -1 if there are no children not previously waited for.
Printed 11/16/83 1