exit(2)
NAME
_exit − terminate a process
SYNTAX
void _exit(status)
int status;
DESCRIPTION
The function _exit terminates a calling process with the following consequences:
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’s termination and the low-order eight bits of status are made available to it. See wait(2).
The parent process ID of all of the calling process’s existing child processes and zombie processes are also set to 1. This means that the initialization process, (see intro(2), inherits each of these processes as well.
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(2), that semadj value is added to the semval of the specified semaphore.
If the process has a process, text or data lock, an unlock is performed.
An accounting record is written on the accounting file if the system’s accounting routine is enabled; see acct(2).
The function _exit circumvents all cleanup.
Most C programs call the library routine exit(3), which performs cleanup actions in the standard i/o library before calling _exit.