1 .\" This manpage is Copyright (C) 1992 Drew Eckhardt;
2 .\" and Copyright (C) 1993 Michael Haardt, Ian Jackson.
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\" Modified Wed Jul 21 23:02:38 1993 by Rik Faith <faith@cs.unc.edu>
7 .\" Modified 2001-11-17, aeb
9 .TH _EXIT 2 2021-03-22 "Linux man-pages (unreleased)"
11 _exit, _Exit \- terminate the calling process
14 .RI ( libc ", " \-lc )
17 .B #include <unistd.h>
19 .BI "noreturn void _exit(int " status );
21 .B #include <stdlib.h>
23 .BI "noreturn void _Exit(int " status );
27 Feature Test Macro Requirements for glibc (see
28 .BR feature_test_macros (7)):
33 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
37 terminates the calling process "immediately".
38 Any open file descriptors belonging to the process are closed.
39 Any children of the process are inherited by
41 (or by the nearest "subreaper" process as defined through the use of the
43 .B PR_SET_CHILD_SUBREAPER
45 The process's parent is sent a
51 is returned to the parent process as the process's exit status, and
52 can be collected by the parent using one of the
61 These functions do not return.
63 POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.
66 was introduced by C99.
68 For a discussion on the effects of an exit, the transmission of
69 exit status, zombie processes, signals sent, and so on, see
77 functions registered with
83 streams are not flushed.
86 does close open file descriptors, and this may cause an unknown delay,
87 waiting for pending output to finish.
88 If the delay is undesired,
89 it may be useful to call functions like
93 Whether any pending I/O is canceled, and which pending I/O may be
96 is implementation-dependent.
97 .SS C library/kernel differences
98 The text above in DESCRIPTION describes the traditional effect of
100 which is to terminate a process,
101 and these are the semantics specified by POSIIX.1 and implemented
102 by the C library wrapper function.
103 On modern systems, this means termination of all threads in the process.
105 By contrast with the C library wrapper function, the raw Linux
107 system call terminates only the calling thread, and actions such as
108 reparenting child processes or sending
110 to the parent process are performed only if this is
111 the last thread in the thread group.
112 .\" _exit() is used by pthread_exit() to terminate the calling thread
114 In glibc up to version 2.3, the
116 wrapper function invoked the kernel system call of the same name.
117 Since glibc 2.3, the wrapper function invokes
119 in order to terminate all of the threads in a process.