Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

acct(2)

fork(2)

intro(2)

plock(2)

semop(2)

wait(2)

signal(3)




exit(2) exit(2)
NAME exit, _exit - terminate process SYNOPSIS void exit(status) int status; 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 execut- ing a wait(2), it is notified of the termination of the calling process and the low-order 8 bits (bits 0377) of status are made available to it (see wait(2)). A SIGCHLD signal is sent to the parent process of the calling process. If the parent process of the calling process is not ex- ecuting a wait, the calling process is transformed into a zombie process, and the exit status is saved for re- turn to the parent should the parent subsequently exe- cute a wait(2). 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. The parent process ID of all existing child processes and zombie processes of the calling process is set to 1. This means the initialization process (see in- tro(2)) inherits each of these processes. Each attached shared-memory segment is detached, and the value of shm_nattach in the data structure associ- ated 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)). April, 1990 1



exit(2) exit(2)
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. All open file descriptors and directory streams of the calling process are closed. If the process is a con- trolling process, a SIGHUP signal is sent to each pro- cess in the foreground process group of the controlling terminal belonging to the calling process. The control- ling terminal associated with the session is disassoci- ated from the session. If the termination of the calling process causes a pro- cess group to be orphaned and if any member of this process group is stopped, a SIGHUP, followed by a SIGCONT signal is sent to each process in the process group. The C function exit may cause cleanup actions before the process exits. The function _exit circumvents all cleanup. SEE ALSO acct(2), fork(2), intro(2), plock(2), semop(2), wait(2), signal(3). WARNINGS See the warning section in signal(3). 2 April, 1990

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026