exit
perform normal program termination
You're viewing an older version of this page (#3237). View the current version.
NAME
<span class="Nm" id="exit">exit</span>, <span class="Nm" id="_Exit">_Exit</span>
INTERFACE
#include <stdlib.h> void exit ( int status ) void _Exit ( int status )
DESCRIPTION
The exit and _Exit functions terminate a process. \n \n Before termination, exit performs the following functions in the order listed:
- Call the functions registered with the atexit (3) function, in the reverse order of their registration.
- Flush all open output streams.
- Close all open streams.
- Unlink all files created with the tmpfile (3) function.
\n \n The _Exit function terminates without calling the functions registered with the atexit (3) function, and may or may not perform the other actions listed. Both functions make the low-order eight bits of the \c status argument available to a parent process which has called a reference:wait (2) -family function. \n \n The C Standard (<span class="Pq"></span>) defines the values <span class="Li">0</span>, <span class="Dv">EXIT_SUCCESS</span>, and <span class="Dv">EXIT_FAILURE</span> as possible values of \c status. Cooperating processes may use other values; in a program which might be called by a mail transfer agent, the values described in reference:sysexits (3) may be used to provide more information to the parent process. \n \n Note that exit does nothing to prevent bottomless recursion should a function registered using atexit (3) itself call exit . Such functions must call _Exit instead (although this has other effects as well which may not be desired).
RETURN VALUES
The exit and _Exit functions never return.
SEE ALSO
reference:_exit (2) , reference:wait (2) , atexit (3) , reference:intro (3) , reference:sysexits (3) , tmpfile (3)
STANDARDS
The exit and _Exit functions conform to