|
Hopefully, this page is exactly what you are looking for, but if not, you can always find further assistance on Unix/Linux Forum!
EXIT(3) Linux Programmer's Manual EXIT(3)
NAME
exit - cause normal process termination
SYNOPSIS
#include <stdlib.h>
void exit(int status);
DESCRIPTION
The exit() function causes normal process termination and the value of
status & 0377 is returned to the parent (see wait(2)).
All functions registered with atexit() and on_exit() are called, in the
reverse order of their registration. (It is possible for one of these
functions to use atexit() or on_exit() to register an additional func-
tion to be executed during exit processing; the new registration is
added to the front of the list of functions that remain to be called.)
All open streams are flushed and closed. Files created by tmpfile()
are removed.
The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE,
that may be passed to exit() to indicate successful or unsuccessful
termination, respectively.
RETURN VALUE
The exit() function does not return.
CONFORMING TO
SVID 3, POSIX, 4.3BSD, ISO 9899 (``ANSI C'')
NOTES
It is undefined what happens if one of the functions registered using
atexit() and on_exit() calls either exit() or longjmp().
The use of EXIT_SUCCESS and EXIT_FAILURE is slightly more portable (to
non-Unix environments) than that of 0 and some non-zero value like 1 or
-1. In particular, VMS uses a different convention.
BSD has attempted to standardize exit codes; see the file <sysexits.h>.
After exit(), the exit status must be transmitted to the parent pro-
cess. There are three cases. If the parent has set SA_NOCLDWAIT, or has
set the SIGCHLD handler to SIG_IGN, the status is discarded. If the
parent was waiting on the child it is notified of the exit status. In
both cases the exiting process dies immediately. If the parent has not
indicated that it is not interested in the exit status, but is not
waiting, the exiting process turns into a "zombie" process (which is
nothing but a container for the single byte representing the exit sta-
tus) so that the parent can learn the exit status when it later calls
one of the wait() functions.
If the implementation supports the SIGCHLD signal, this signal is sent
to the parent. If the parent has set SA_NOCLDWAIT, it is undefined
whether a SIGCHLD signal is sent.
If the process is a session leader and its controlling terminal is the
controlling terminal of the session, then each process in the fore-
ground process group of this controlling terminal is sent a SIGHUP sig-
nal, and the terminal is disassociated from this session, allowing it
to be acquired by a new controlling process.
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 will be sent to each pro-
cess in this process group.
SEE ALSO
_exit(2), wait(2), atexit(3), on_exit(3), tmpfile(3)
2001-11-17 EXIT(3)
Man(1) output converted with
man2html and wrapped by fishsponge
This page was generated on Tue Feb 13 02:21:03 GMT 2007
|
Your favourite pages:
No pages logged yet. Trying to save cookie... Top 10 most popular pages:
sqlite3 man page (5323 hits) (openSUSE 10.2)
svn man page (5180 hits) (FreeBSD 6.2)
adv_cap_autoneg man page (4865 hits) (Solaris 10 11_06)
CPAN man page (4602 hits) (Suse Linux 10.1)
ssh man page (4337 hits) (Suse Linux 10.1)
ssh-socks5-proxy-connect man page (2843 hits) (Solaris 10 11_06)
netcat man page (2690 hits) (Suse Linux 10.1)
pprosetup man page (2474 hits) (Solaris 10 11_06)
startproc man page (2456 hits) (Suse Linux 10.1)
signal man page (2395 hits) (Suse Linux 10.1)
|