Manual Page Result
0
Command: exit | Section: 2 | Source: UNIX v10 | File: exit.2
EXIT(2) System Calls Manual EXIT(2)
NAME
_exit, wait wait3 - terminate process, wait for child to terminate
SYNOPSIS
void _exit(status)
int status;
int wait(status)
int *status;
int wait((int *)0)
#include <sys/vtimes.h>
wait3(status, options, ch_vt)
int *status;
struct vtimes *ch_vt;
DESCRIPTION
_exit closes all the process's files and notifies the parent process
when the parent executes wait. The low-order 8 bits of status are
available to the parent process. The call never returns.
The function exit(3), which is the normal means of terminating a
process, may cause cleanup actions before finally calling _exit.
Therefore, _exit should be called to terminate a child process after a
fork(2) to avoid flushing buffered output twice.
Wait delays until a signal is received or until a child processes ter-
minates or receives signal SIGSTOP. There is no delay if any child has
died since the last wait, or if there are no extant children. The nor-
mal return yields the process id and status of one terminated child.
The status of other children may be learned from further wait calls.
If status is nonzero, wait sets *status = (s<<8)+t where s is the low 8
bits of status from the child's exit, if any, and t is the termination
status of the child. See signal(2) for a list of termination statuses
(signals); status 0 indicates normal termination, 0177 a (restartable)
process stopped on SIGSTOP. If the 0200 bit of the termination status
is set, a core image of the process was produced by the system.
Wait3 is similar to wait. An option value of 1 prevents waiting for
extant, non-stopped children and causes 0 to be returned if children
exist but none have reportable status. If ch_vt is nonzero, resource
usage data for the child are reported as by vtimes(2).
If the parent process terminates without waiting on its children, they
are inherited by process 1 (the initialization process, init(8)).
SEE ALSO
fork(2), exit(3), signal(2), sh(1)
DIAGNOSTICS
wait, wait3: ECHILD
BUGS
If the argument to wait is bogus, the user program gets a memory fault
rather than an EFAULT.
The 0 third argument to wait3 is a required historical dreg.
EXIT(2)