EXIT(3)                    POSIX Programmer's Manual                   EXIT(3)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.

NNAAMMEE
       exit -- terminate a process

SSYYNNOOPPSSIISS
       #include <stdlib.h>

       void exit(int _s_t_a_t_u_s);

DDEESSCCRRIIPPTTIIOONN
       The functionality described on this reference page is aligned with the
       ISO C standard. Any conflict between the requirements described here
       and the ISO C standard is unintentional. This volume of POSIX.1-2017
       defers to the ISO C standard.

       The value of _s_t_a_t_u_s may be 0, EXIT_SUCCESS, EXIT_FAILURE, or any other
       value, though only the least significant 8 bits (that is, _s_t_a_t_u_s &
       0377) shall be available from _w_a_i_t() and _w_a_i_t_p_i_d(); the full value
       shall be available from _w_a_i_t_i_d() and in the ssiiggiinnffoo__tt passed to a
       signal handler for SIGCHLD.

       The _e_x_i_t() function shall first call all functions registered by
       _a_t_e_x_i_t(), in the reverse order of their registration, except that a
       function is called after any previously registered functions that had
       already been called at the time it was registered. Each function is
       called as many times as it was registered. If, during the call to any
       such function, a call to the _l_o_n_g_j_m_p() function is made that would
       terminate the call to the registered function, the behavior is
       undefined.

       If a function registered by a call to _a_t_e_x_i_t() fails to return, the
       remaining registered functions shall not be called and the rest of the
       _e_x_i_t() processing shall not be completed. If _e_x_i_t() is called more than
       once, the behavior is undefined.

       The _e_x_i_t() function shall then flush all open streams with unwritten
       buffered data and close all open streams. Finally, the process shall be
       terminated with the same consequences as described in _C_o_n_s_e_q_u_e_n_c_e_s _o_f
       _P_r_o_c_e_s_s _T_e_r_m_i_n_a_t_i_o_n.

RREETTUURRNN VVAALLUUEE
       The _e_x_i_t() function does not return.

EERRRROORRSS
       No errors are defined.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

EEXXAAMMPPLLEESS
       None.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       None.

RRAATTIIOONNAALLEE
       See ___E_x_i_t().

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       ___E_x_i_t(), _a_t_e_x_i_t(), _e_x_e_c, _l_o_n_g_j_m_p(), _t_m_p_f_i_l_e(), _w_a_i_t(), _w_a_i_t_i_d()

       The Base Definitions volume of POSIX.1-2017, <<ssttddlliibb..hh>>

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1-2017, Standard for Information Technology --
       Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the
       Institute of Electrical and Electronics Engineers, Inc and The Open
       Group.  In the event of any discrepancy between this version and the
       original IEEE and The Open Group Standard, the original IEEE and The
       Open Group Standard is the referee document. The original Standard can
       be obtained online at http://www.opengroup.org/unix/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2017                              EXIT(3)
