exit(2) DG/UX 5.4.2 exit(2)
NAME
exit, exit - terminate process
SYNOPSIS
#include <stdlib.h>
void exit(int status);
#include <unistd.h>
void exit(int status);
where:
status An integer indicating the status to be returned
DESCRIPTION
The functions exit() and exit() terminate the calling process. The
function exit() can cause additional processing to be done before the
process exits [see atexit(3C) and fclose(3S)].
In addition, termination will have the following consequences:
All of the file descriptors, directory streams and message
catalogue descriptors open in the calling process are closed.
A SIGCHLD signal is sent to the calling process's parent
process.
If the parent process of the calling process is executing
either wait(), waitpid(), or waitid() see [wait(2), waitpid(),
waitid()],and has not set its SANOCLDWAIT flag [see
sigaction(2)], it is notified of the calling process'
termination, the calling process' status is made available to
it, and the lifetime of the calling process ends.
If the calling process' parent process is not executing either
wait(), waitpid(), or waitid(), and has not set its
SANOCLDWAIT flag, the calling process is transformed into a
zombie process. The status of the child process will be
available to the parent process when the parent process
subsequently executes a wait function. At that time, the
lifetime of the calling process will end.
If the parent process of the calling process has set its
SANOCLDWAIT flag, the status will be discarded, and the
lifetime of the calling process will end immediately.
The parent process ID of all of the calling process' child
processes is set to the process ID of a the initialization
process, which has a process ID of 1. This means the
initialization process [see intro(2)] inherits each of these
processes.
Each attached shared memory segment is detached and the value
Licensed material--property of copyright holder(s) 1
exit(2) DG/UX 5.4.2 exit(2)
of shmnattach 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.
An accounting record is written on the accounting file if the
system's accounting routine is enabled [see acct(2)].
If the process is a controlling process, SIGHUP is sent to the
foreground process group of its controlling terminal and its
controlling terminal is deallocated.
If the calling process has any stopped children whose process
group will be orphaned when the calling process exits, or if
the calling process is a member of a process group that will
be orphaned when the calling process exits, that process group
will be sent SIGHUP and SIGCONT signals.
The C function exit(3C) calls any functions registered through the
atexit function in the reverse order of their registration. The
function exit circumvents all such functions and cleanup.
The symbols EXITSUCCESS and EXITFAILURE are defined in stdlib.h and
may be used as the value of status to indicate successful or
unsuccessful termination, respectively.
SEE ALSO
acct(2), intro(2), semop(2), sigaction(2), signal(2), times(2),
wait(2), atexit(3C).
NOTES
See signal(2).
Licensed material--property of copyright holder(s) 2