

wait()                 COHERENT System Call                wait()




Await completion of a child process

wwaaiitt(_s_t_a_t_p)
iinntt *_s_t_a_t_p;

wait  suspends execution  of the invoking  process until  a child
process (created  with fork) terminates.  It  returns the process
identifier  of the  terminating child process.   If there  are no
children or if an interrupt occurs, it returns -1.

If it  is successful, wait returns the  process identifier of the
terminated child process.  In addition, wait fills in the integer
pointed to  by statp with exit-status  information about the com-
pleted process.  If  statp is NULL, wait discards the exit-status
information.

wait fills  in the low  byte of the  status-information word with
the termination status of the child process.  A child process may
have terminated because of a  signal, because of an exit call, or
have  stopped execution  during ptrace.   Termination  with exit,
which is  normal completion, gives status  0.  Other terminations
give signal  values as status (as defined in  the article on sig-
nal).  The 0200 bit of the status code indicates that a core dump
was produced.   A status  of 0177  indicates that the  process is
waiting for further action from ptrace.

The high byte of the returned status is the low byte of the argu-
ment to the exit system call.

If a  parent process does not remain in  existence long enough to
wait on a child process,  the child process is adopted by process
1 (the initialization process).

***** See Also *****

_exit(), COHERENT system calls, fork(), ptrace(), signal()




















COHERENT Lexicon                                           Page 1


