EXIT(S) XENIX System V EXIT(S)
Name
exit, _exit - Terminates a process.
Syntax
exit (status)
void int status;
void _exit (status)
int status;
Description
exit terminates the calling process. All of the file
descriptors open in the calling process are closed.
If the parent process of the calling process is executing a
wait, it is notified of the calling process' termination and
the low-order 8 bits (i.e., bits 0377) of status are made
available to it; see wait(S). If the parent is not waiting,
the child's status will be made available to it when the
parent subsequently executes wait(S).
If the parent process of the calling process is not
executing a wait, the calling process is transformed into a
``zombie process.'' A zombie process is a process that only
occupies a slot in the process table, it has no other space
allocated either in user or kernel space. The process table
slot that it occupies is partially overlaid with time
accounting information (see <sys/proc.h>) to be used by
times(S).
The parent process ID of all of the calling process'
existing child processes and zombie processes is set to 1.
This means the initialization process (see intro(S))
inherits each of these processes.
Each attached shared memory segment is detached and the
value of shm_nattach in the data structure associated with
its shared memory identifier is decremented by 1.
For each semaphore for which the calling process has set a
semadj value (see semop(S)), that semadj value is added to
the semval of the specified semaphore.
If the process has a text, data lock, or process, an unlock
is performed (see plock(S)).
An accounting record is written on the accounting file if
the system's accounting routine is enabled; see acct(S).
Page 1 (printed 8/7/87)
EXIT(S) XENIX System V EXIT(S)
If the process ID, TTY group ID, and process group ID of the
calling process are equal, the SIGHUP signal is sent to each
of the processes that has a process group ID equal to that
of the calling process.
The C function exit may cause cleanup actions before the
process exits. The _exit circumvents all cleanup.
See Also
acct(S), intro(S), plock(S), semop(S), signal(S), wait(S)
Warning
See Warning in signal(S)
Page 2 (printed 8/7/87)