EXIT(2-POSIX) RISC/os Reference Manual EXIT(2-POSIX)
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 executing a
wait or waitpid function, it is notified of the calling pro-
cess' termination and the low order eight bits (i.e., bits
0377) of status are made available to it [see wait(2)].
If the parent process of the calling process is not execut-
ing a wait or waitpid function, the calling process is
transformed into a zombie process. 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 over-
laid with time accounting information (see <sys/proc.h>) to
be used by times. The exit status code is saved for return
to the parent process whenever an appropriate subsequent
wait or waitpid function is executed.
The parent process ID of all of the calling processes'
existing child processes and zombie processes is set to 1.
This means the initialization process [see intro(2)] inher-
its each of these processes.
If the exit of a process causes a process group to become
orphaned, and if any member of the newly orphaned process
group is stopped, a SIGHUP followed by a SIGCONT will be
sent to each process in the process group.
Each attached shared memory segment is detached and the
value 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.
Printed 1/15/91 Page 1
EXIT(2-POSIX) RISC/os Reference Manual EXIT(2-POSIX)
If the process has a process, text, or data lock, an unlock
is performed [see plock(2)].
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, the controlling
terminal is disassociated from the session, and the SIGHUP
signal is sent to each process that is in the foreground
process group of the controlling terminal belonging to the
calling process.
A death of child signal is sent to the parent.
The C function exit may cause cleanup actions before the
process exits. The function _exit circumvents all cleanup.
SEE ALSO
acct(2), intro(2), plock(2), semop(2), signal(2), sigac-
tion(2), wait(2).
WARNING
See NOTE in signal(2).
DIAGNOSTICS
None. There can be no return from an exit system call.
Page 2 Printed 1/15/91