exit(2)exit(2)Name_exit - terminate a process
The function, terminates a calling process with the following conse‐
· All of the file descriptors open in the calling process are
· If the parent process of the calling process is executing a it is
notified of the calling process's termination and the low-order
eight bits of status are made available to it. For further infor‐
· 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 inherits each of these pro‐
cesses as well. For further information, see
· Each attached shared memory segment is detached and the value of
shm_nattach in the data structure associated with its shared mem‐
ory identifier is decremented by 1.
· For each semaphore for which the calling process has set a semadj
value, (see ) that semadj value is added to the semval of the
· If the process has a process, text, or data lock, an unlock is
· An accounting record is written on the accounting file if the sys‐
tem's accounting routine is enabled. For more information, see
Calling directly circumvents all cleanup. Most C programs call the
library routine which performs cleanup actions in the standard I/O
library before calling
POSIX, System V
The function differs from the System V as well as POSIX definition in
that even if the calling process is a process group leader, the SIGHUP
signal is not sent to each process that has a process group ID equal to
that of the calling process.
The function also differs in that the routine is declared as type int
instead of type void.
See Alsofork(2), wait(2), exit(3), signal(3).