COHERENT manpages
This page displays the COHERENT manpage for wait() [Await completion of a child process].
List of available manpages
Index
wait() -- System Call (libc) Await completion of a child process #include <sys/wait.h> wait(statp) int *statp; 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 completed 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 signal()). 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 argument 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). Example For an example of this system call, see the entry for msgget(). See Also _exit(), fork(), ksh, libc, ptrace(), signal(), sh, waitpid(), wait.h POSIX Standard, §3.2.1