Changes.old: Add missing piece to 5.00 changelog
[man-pages.git] / man2 / _exit.2
blobc55d2a612c1ec73f498eefb4236d4f6f83df5b54
1 .\" This manpage is Copyright (C) 1992 Drew Eckhardt;
2 .\"             and Copyright (C) 1993 Michael Haardt, Ian Jackson.
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
26 .\" Modified Wed Jul 21 23:02:38 1993 by Rik Faith <faith@cs.unc.edu>
27 .\" Modified 2001-11-17, aeb
28 .\"
29 .TH _EXIT 2 2017-05-03 "Linux" "Linux Programmer's Manual"
30 .SH NAME
31 _exit, _Exit \- terminate the calling process
32 .SH SYNOPSIS
33 .B #include <unistd.h>
34 .PP
35 .BI "void _exit(int " status );
37 .B #include <stdlib.h>
38 .PP
39 .BI "void _Exit(int " status );
40 .PP
41 .in -4n
42 Feature Test Macro Requirements for glibc (see
43 .BR feature_test_macros (7)):
44 .in
45 .PP
46 .ad l
47 .BR _Exit ():
48 .RS 4
49 _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
50 .RE
51 .ad
52 .SH DESCRIPTION
53 The function
54 .BR _exit ()
55 terminates the calling process "immediately".
56 Any open file descriptors belonging to the process are closed.
57 Any children of the process are inherited by
58 .BR init (1)
59 (or by the nearest "subreaper" process as defined through the use of the
60 .BR prctl (2)
61 .B PR_SET_CHILD_SUBREAPER
62 operation).
63 The process's parent is sent a
64 .B SIGCHLD
65 signal.
66 .PP
67 The value
68 .I "status & 0377"
69 is returned to the parent process as the process's exit status, and
70 can be collected using one of the
71 .BR wait (2)
72 family of calls.
73 .PP
74 The function
75 .BR _Exit ()
76 is equivalent to
77 .BR _exit ().
78 .SH RETURN VALUE
79 These functions do not return.
80 .SH CONFORMING TO
81 POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.
82 The function
83 .BR _Exit ()
84 was introduced by C99.
85 .SH NOTES
86 For a discussion on the effects of an exit, the transmission of
87 exit status, zombie processes, signals sent, and so on, see
88 .BR exit (3).
89 .PP
90 The function
91 .BR _exit ()
92 is like
93 .BR exit (3),
94 but does not call any
95 functions registered with
96 .BR atexit (3)
98 .BR on_exit (3).
99 Open
100 .BR stdio (3)
101 streams are not flushed.
102 On the other hand,
103 .BR _exit ()
104 does close open file descriptors, and this may cause an unknown delay,
105 waiting for pending output to finish.
106 If the delay is undesired,
107 it may be useful to call functions like
108 .BR tcflush (3)
109 before calling
110 .BR _exit ().
111 Whether any pending I/O is canceled, and which pending I/O may be
112 canceled upon
113 .BR _exit (),
114 is implementation-dependent.
115 .SS C library/kernel differences
116 In glibc up to version 2.3, the
117 .BR _exit ()
118 wrapper function invoked the kernel system call of the same name.
119 Since glibc 2.3, the wrapper function invokes
120 .BR exit_group (2),
121 in order to terminate all of the threads in a process.
122 .SH SEE ALSO
123 .BR execve (2),
124 .BR exit_group (2),
125 .BR fork (2),
126 .BR kill (2),
127 .BR wait (2),
128 .BR wait4 (2),
129 .BR waitpid (2),
130 .BR atexit (3),
131 .BR exit (3),
132 .BR on_exit (3),
133 .BR termios (3)