exit(2)
_________________________________________________________________
exit System Call
Terminate process.
_________________________________________________________________
SYNTAX
None.
void _exit (status)
int status;
PARAMETERS
status A user defined value, the low order 8 bits of
which are made available to the parent of the
calling process.
DESCRIPTION
Exit terminates the calling process, and frees all resources
associated with the process.
All of the object descriptors open in the calling process are
closed (which releases any file locks held).
The calling process's working and root directories are released.
The terminating process's PID and the low-order eight bits of the
status argument are recorded for notification to the process's
parent when the parent executes the "wait" system call. Until
the parent acknowledges the termination using "wait", 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. The parent is sent SIGCLD and SIGCHLD
signals to notify it that one of its children has terminated. If
the parent is ignoring SIGCLD, 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. PID 1 must take
responsibility for acknowledging the termination of these
processes. Any child processes that were being traced are
terminated by sending them SIGKILL; any child processes that were
stopped are notified of their parent's demise by sending them
SIGCONT and SIGHUP.
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
exit(2)
If the process is a child created by vfork, all shared 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.
Special processing is performed when a process group leader
terminates if the process was established as a process group
leader by calling setpgrp without arguments (the SYS V version of
the setpgrp() call). If the process group leader is a member of
its control terminal's process group, the SIGHUP signal is sent
to the control terminal's process group. Also, if the process is
a process group leader, each member of its process group is made
a member of the null process group. If the process was
established as a process group leader by calling setpgrp with
arguments (the BSD version of the setpgrp() call) , these actions
are not performed.
ACCESS CONTROL
No access checking is performed by this call.
RETURN VALUE
This call never returns under any circumstances.
EXCEPTIONS
No exceptions are generated by this call.
SEE ALSO
The related system calls: acct, plock, semop, setpgrp, signal,
wait.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)