1EXIT(3P) POSIX Programmer's Manual EXIT(3P)
2
3
4
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
11
13 exit — terminate a process
14
16 #include <stdlib.h>
17
18 void exit(int status);
19
21 The functionality described on this reference page is aligned with the
22 ISO C standard. Any conflict between the requirements described here
23 and the ISO C standard is unintentional. This volume of POSIX.1‐2008
24 defers to the ISO C standard.
25
26 The value of status may be 0, EXIT_SUCCESS, EXIT_FAILURE, or any other
27 value, though only the least significant 8 bits (that is, status &
28 0377) shall be available to a waiting parent process.
29
30 The exit() function shall first call all functions registered by
31 atexit(), in the reverse order of their registration, except that a
32 function is called after any previously registered functions that had
33 already been called at the time it was registered. Each function is
34 called as many times as it was registered. If, during the call to any
35 such function, a call to the longjmp() function is made that would ter‐
36 minate the call to the registered function, the behavior is undefined.
37
38 If a function registered by a call to atexit() fails to return, the
39 remaining registered functions shall not be called and the rest of the
40 exit() processing shall not be completed. If exit() is called more than
41 once, the behavior is undefined.
42
43 The exit() function shall then flush all open streams with unwritten
44 buffered data and close all open streams. Finally, the process shall be
45 terminated with the same consequences as described in Consequences of
46 Process Termination.
47
49 The exit() function does not return.
50
52 No errors are defined.
53
54 The following sections are informative.
55
57 None.
58
60 None.
61
63 See _Exit().
64
66 None.
67
69 _Exit(), atexit(), exec, longjmp(), tmpfile()
70
71 The Base Definitions volume of POSIX.1‐2008, <stdlib.h>
72
74 Portions of this text are reprinted and reproduced in electronic form
75 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
76 -- Portable Operating System Interface (POSIX), The Open Group Base
77 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
78 cal and Electronics Engineers, Inc and The Open Group. (This is
79 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) 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.unix.org/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 2013 EXIT(3P)