1EXIT(3P)                   POSIX Programmer's Manual                  EXIT(3P)
2
3
4

PROLOG

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

NAME

12       exit — terminate a process
13

SYNOPSIS

15       #include <stdlib.h>
16
17       void exit(int status);
18

DESCRIPTION

20       The functionality described on this reference page is aligned with  the
21       ISO C  standard.  Any  conflict between the requirements described here
22       and the ISO C standard is unintentional. This  volume  of  POSIX.1‐2017
23       defers to the ISO C standard.
24
25       The  value of status may be 0, EXIT_SUCCESS, EXIT_FAILURE, or any other
26       value, though only the least significant 8  bits  (that  is,  status  &
27       0377)  shall  be  available  from  wait() and waitpid(); the full value
28       shall be available from waitid() and in the siginfo_t passed to a  sig‐
29       nal handler for SIGCHLD.
30
31       The  exit()  function  shall  first  call  all  functions registered by
32       atexit(), in the reverse order of their  registration,  except  that  a
33       function  is  called after any previously registered functions that had
34       already been called at the time it was  registered.  Each  function  is
35       called  as  many times as it was registered. If, during the call to any
36       such function, a call to the longjmp() function is made that would ter‐
37       minate the call to the registered function, the behavior is undefined.
38
39       If  a  function  registered  by a call to atexit() fails to return, the
40       remaining registered functions shall not be called and the rest of  the
41       exit() processing shall not be completed. If exit() is called more than
42       once, the behavior is undefined.
43
44       The exit() function shall then flush all open  streams  with  unwritten
45       buffered data and close all open streams. Finally, the process shall be
46       terminated with the same consequences as described in  Consequences  of
47       Process Termination.
48

RETURN VALUE

50       The exit() function does not return.
51

ERRORS

53       No errors are defined.
54
55       The following sections are informative.
56

EXAMPLES

58       None.
59

APPLICATION USAGE

61       None.
62

RATIONALE

64       See _Exit().
65

FUTURE DIRECTIONS

67       None.
68

SEE ALSO

70       _Exit(), atexit(), exec, longjmp(), tmpfile(), wait(), waitid()
71
72       The Base Definitions volume of POSIX.1‐2017, <stdlib.h>
73
75       Portions  of  this text are reprinted and reproduced in electronic form
76       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
77       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
78       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
79       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
80       event of any discrepancy between this version and the original IEEE and
81       The  Open Group Standard, the original IEEE and The Open Group Standard
82       is the referee document. The original Standard can be  obtained  online
83       at http://www.opengroup.org/unix/online.html .
84
85       Any  typographical  or  formatting  errors that appear in this page are
86       most likely to have been introduced during the conversion of the source
87       files  to  man page format. To report such errors, see https://www.ker
88       nel.org/doc/man-pages/reporting_bugs.html .
89
90
91
92IEEE/The Open Group                  2017                             EXIT(3P)
Impressum