]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/_exit.2
Ready for 5.00
[thirdparty/man-pages.git] / man2 / _exit.2
CommitLineData
fea681da 1.\" This manpage is Copyright (C) 1992 Drew Eckhardt;
ac56b6a8 2.\" and Copyright (C) 1993 Michael Haardt, Ian Jackson.
fea681da 3.\"
93015253 4.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
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.
c13182ef 13.\"
fea681da
MK
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.
c13182ef 21.\"
fea681da
MK
22.\" Formatted or processed versions of this manual, if unaccompanied by
23.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 24.\" %%%LICENSE_END
fea681da
MK
25.\"
26.\" Modified Wed Jul 21 23:02:38 1993 by Rik Faith <faith@cs.unc.edu>
27.\" Modified 2001-11-17, aeb
28.\"
734882f4 29.TH _EXIT 2 2017-05-03 "Linux" "Linux Programmer's Manual"
fea681da 30.SH NAME
a1ffe9f5 31_exit, _Exit \- terminate the calling process
fea681da
MK
32.SH SYNOPSIS
33.B #include <unistd.h>
68e4db0a 34.PP
fea681da 35.BI "void _exit(int " status );
f90f031e 36
fea681da 37.B #include <stdlib.h>
68e4db0a 38.PP
fea681da 39.BI "void _Exit(int " status );
68e4db0a 40.PP
cc4615cc
MK
41.in -4n
42Feature Test Macro Requirements for glibc (see
43.BR feature_test_macros (7)):
44.in
68e4db0a 45.PP
e0a98111 46.ad l
cc4615cc 47.BR _Exit ():
e0a98111 48.RS 4
e464f054 49_ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
c9f2ff9d 50.RE
e0a98111 51.ad
fea681da
MK
52.SH DESCRIPTION
53The function
63aa9df0 54.BR _exit ()
c13182ef 55terminates the calling process "immediately".
55873ed6 56Any open file descriptors belonging to the process are closed.
99ed723a 57Any children of the process are inherited by
a88f0e06 58.BR init (1)
99ed723a
MK
59(or by the nearest "subreaper" process as defined through the use of the
60.BR prctl (2)
61.B PR_SET_CHILD_SUBREAPER
62operation).
55873ed6 63The process's parent is sent a
fea681da
MK
64.B SIGCHLD
65signal.
dd3568a1 66.PP
fea681da 67The value
ccb3ff19 68.I "status & 0377"
fea681da
MK
69is returned to the parent process as the process's exit status, and
70can be collected using one of the
0bfa087b 71.BR wait (2)
fea681da 72family of calls.
dd3568a1 73.PP
fea681da 74The function
63aa9df0 75.BR _Exit ()
fea681da 76is equivalent to
63aa9df0 77.BR _exit ().
47297adb 78.SH RETURN VALUE
fea681da 79These functions do not return.
47297adb 80.SH CONFORMING TO
5a3b5c1d 81POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.
60a90ecd
MK
82The function
83.BR _Exit ()
84was introduced by C99.
fea681da
MK
85.SH NOTES
86For a discussion on the effects of an exit, the transmission of
078a7d6e 87exit status, zombie processes, signals sent, and so on, see
fea681da 88.BR exit (3).
dd3568a1 89.PP
fea681da 90The function
63aa9df0 91.BR _exit ()
60a90ecd
MK
92is like
93.BR exit (3),
94but does not call any
7b57506d 95functions registered with
0bfa087b 96.BR atexit (3)
c13182ef 97or
0bfa087b 98.BR on_exit (3).
29c4533c
MK
99Open
100.BR stdio (3)
101streams are not flushed.
fea681da 102On the other hand,
63aa9df0 103.BR _exit ()
fea681da 104does close open file descriptors, and this may cause an unknown delay,
c13182ef
MK
105waiting for pending output to finish.
106If the delay is undesired,
988db661 107it may be useful to call functions like
0bfa087b 108.BR tcflush (3)
60a90ecd
MK
109before calling
110.BR _exit ().
d9bfdb9c
MK
111Whether any pending I/O is canceled, and which pending I/O may be
112canceled upon
60a90ecd
MK
113.BR _exit (),
114is implementation-dependent.
0722a578 115.SS C library/kernel differences
9abeddb2
MK
116In glibc up to version 2.3, the
117.BR _exit ()
118wrapper function invoked the kernel system call of the same name.
119Since glibc 2.3, the wrapper function invokes
120.BR exit_group (2),
121in order to terminate all of the threads in a process.
47297adb 122.SH SEE ALSO
fea681da 123.BR execve (2),
f02720dd 124.BR exit_group (2),
fea681da
MK
125.BR fork (2),
126.BR kill (2),
127.BR wait (2),
128.BR wait4 (2),
129.BR waitpid (2),
7b57506d 130.BR atexit (3),
fea681da 131.BR exit (3),
7b57506d 132.BR on_exit (3),
fea681da 133.BR termios (3)