exit(2)
NAME
_exit − terminate process
SYNOPSIS
void _exit (status)
int status;
DESCRIPTION
exit terminates the 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 (i.e., bits 0377) of status are made available to it; see wait(2).
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.
If the process exiting has been attached to a debugging process as a result of a ptrace(2) request PT_TRACE_CHILD or PT_TRACE_PROC, the debugging process is sent a SIGCHLD signal, and the low order eight bits of status are made available to it; see wait(2).
If the process exiting has attached any processes to itself as a result of a ptrace(2) request PT_TRACE_CHILD or PT_TRACE_PROC, all processes that are attached to the exiting process are marked as not being traced and have a SIGKILL signal sent to them.
The parent process ID of all of the calling process’s existing child processes and zombie processes is set to 1. This means the initialization process (see intro(2)) 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(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 (see plock(2)).
Any locks established by the process via calls to mlockall() or mlock() are removed. If locked pages in the calling process’ address space are also mapped into other process’ address spaces and are locked by those processes, the locks established by the other processes are unaffected by this process’s call to exit().
Any outstanding cancelable asynchronous I/O operations may be cancelled. An outstanding request will be cancelled if the actual I/O operation has not occured. Otherwise, it is allowed to go through I/O completion. However, on exit() all signals to the process are disabled, which means any signal generated because of the I/O completion will not affect the process. Those asynchronous I/O operations which are not cancelled complete as if the _exit() operation had not yet occurred.
An accounting record is written on the accounting file if the system’s accounting routine is enabled; see acct(2).
If the process ID, tty group ID, and process group ID of the calling process are equal, the SIGHUP signal is sent to each process that has a process group ID equal to that of the calling process. This action is not performed on 4.2BSD systems.
In the att universe a SIGCLD signal is sent to the parent process, while in the ucb universe a SIGCHLD signal is sent. The parent process may of course choose to ignore or catch the signal.
The C function exit(3C) may cause cleanup actions before the process exits. The function _exit circumvents all cleanup.
SEE ALSO
acct(2), atexit(3c), exit(3c), intro(2), plock(2), semop(2), signal(2), wait(2).
WARNING
See WARNING in signal(2).
CX/UX Programmer’s Reference Manual