exit(2) DG/UX 4.30 exit(2)
NAME
_exit - Terminate a process.
SYNOPSIS
void _exit (status)
int status;
DESCRIPTION
The exit() function shall terminate the calling process
with the following consequences:
(1) All open file descriptors and directory streams in
the calling process are closed.
(2) If the parent process of the calling process is
executing a wait() or waitpid(), it is notified of the
calling process's termination and the low order 8 bits
of status() are made available to it; see wait(2).
(3) If the parent process of the calling process is not
executing a wait() or waitpid() function, the exit
status() code is saved for return to the parent process
whenever the parent process executes an appropriate
subsequent wait() or waitpid().
(4) Termination of a process does not directly
terminate its children. The sending of a SIGHUP signal
as described below indirectly terminates children in
some circumstances. Children of a terminated process
shall be assigned a new parent process ID,
corresponding to an implementation-defined system
process.
(5) If the implementation supports the SIGCHLD signal,
a SIGCHLD signal shall be sent to the parent process.
(6) If the process is a controlling process, the SIGHUP
signal shall be sent to each process in the foreground
process group of the controlling terminal belonging to
the calling process.
(7) If the process is a controlling process, the
controlling terminal associated with the session is
disassociated from the session, allowing it to be
acquired by a new controlling process.
(8) If the implementation supports job control, and if
the exit of the process causes a process group to
become orphaned, and if any member of the newly-
orphaned process group is stopped, then a SIGHUP signal
followed by a SIGCONT signal shall be sent to each
process in the newly-orphaned process group.
Licensed material--property of copyright holder(s) Page 1
exit(2) DG/UX 4.30 exit(2)
These consequences shall occur on process termination for
any reason.
RETURNS
The exit() function cannot return to its caller.
SEE ALSO
close(2), sigaction(2), wait(2)
COPYRIGHTS
Portions of this text are reprinted from IEEE Std 1003.1-
1988, Portable Operating System Interface for Computer
Environment, copyright © 1988 by the Institute of Electrical
and Electronics Engineers, Inc., with the permission of the
IEEE Standards Department. To purchase IEEE Standards, call
800/678-IEEE.
In the event of a discrepancy between the electronic and the
original printed version, the original version takes
precedence.
STANDARDS
Both the SIGCHLD signal and job control are supported by the
implementation.
Note that the closing of all file descriptors opened in the
calling process means that all file locks held by the
process will be released.
The calling process's working and root directories are
released.
Until the calling process's parent acknowledges the
termination using wait() or waitpid(), the terminating
process's PID is not available for reuse, and the process
still counts against per-user and system-wide limits on the
number of processes.
A SIGCHLD signal shall be sent to the parent of the
terminating process. If the parent is ignoring SIGCHLD, the
child's system-wide resources will be freed anyway during
the parent's next system-call (when the parent processes
signals).
All of the terminating process's existing children and
unacknowledged terminated children have their parent process
set to be PID 1, the root of the process tree.
Any child processes that were being traced are terminated by
sending them the signal SIGKILL.
If the process is a child created by vfork(), all shared
Licensed material--property of copyright holder(s) Page 2
exit(2) DG/UX 4.30 exit(2)
memory segments are returned to its parent. Otherwise, each
attached shared memory segment is detached.
For each semaphore for which the calling process has set a
semaphore adjust value (see semop()), that value is added to
the value of the specified semaphore.
If the process has a text or data lock, an unlock is
performed (see plock()). However, if the process is a child
created by vfork(), these locks are returned to its parent
along with the rest of the address space.
All interval timers are discarded.
An accounting record is written on the accounting file if
the system's accounting routine is enabled; see acct().
Licensed material--property of copyright holder(s) Page 3