]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/_exit.2
getent.1, intro.1, time.1, _exit.2, _syscall.2, accept.2, access.2, acct.2, adjtimex...
[thirdparty/man-pages.git] / man2 / _exit.2
CommitLineData
fea681da
MK
1.\" Hey Emacs! This file is -*- nroff -*- source.
2.\"
3.\" This manpage is Copyright (C) 1992 Drew Eckhardt;
4.\" 1993 Michael Haardt, Ian Jackson.
5.\"
6.\" Permission is granted to make and distribute verbatim copies of this
7.\" manual provided the copyright notice and this permission notice are
8.\" preserved on all copies.
9.\"
10.\" Permission is granted to copy and distribute modified versions of this
11.\" manual under the conditions for verbatim copying, provided that the
12.\" entire resulting derived work is distributed under the terms of a
13.\" permission notice identical to this one.
c13182ef 14.\"
fea681da
MK
15.\" Since the Linux kernel and libraries are constantly changing, this
16.\" manual page may be incorrect or out-of-date. The author(s) assume no
17.\" responsibility for errors or omissions, or for damages resulting from
18.\" the use of the information contained herein. The author(s) may not
19.\" have taken the same level of care in the production of this manual,
20.\" which is licensed free of charge, as they might when working
21.\" professionally.
c13182ef 22.\"
fea681da
MK
23.\" Formatted or processed versions of this manual, if unaccompanied by
24.\" the source, must acknowledge the copyright and authors of this work.
25.\"
26.\" Modified Wed Jul 21 23:02:38 1993 by Rik Faith <faith@cs.unc.edu>
27.\" Modified 2001-11-17, aeb
28.\"
50831f9b 29.TH _EXIT 2 2010-09-20 "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>
34.sp
35.BI "void _exit(int " status );
36.sp
37.B #include <stdlib.h>
38.sp
39.BI "void _Exit(int " status );
cc4615cc
MK
40.sp
41.in -4n
42Feature Test Macro Requirements for glibc (see
43.BR feature_test_macros (7)):
44.in
45.sp
e0a98111 46.ad l
cc4615cc 47.BR _Exit ():
e0a98111 48.RS 4
6c3f0228
MK
49_XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
50_POSIX_C_SOURCE\ >=\ 200112L;
e0a98111
MK
51.br
52or
cc4615cc 53.I cc\ -std=c99
c9f2ff9d 54.RE
e0a98111 55.ad
fea681da
MK
56.SH DESCRIPTION
57The function
63aa9df0 58.BR _exit ()
c13182ef
MK
59terminates the calling process "immediately".
60Any open file descriptors
fea681da 61belonging to the process are closed; any children of the process are
c13182ef 62inherited by process 1,
7b57506d
MK
63.IR init ,
64and the process's parent is sent a
fea681da
MK
65.B SIGCHLD
66signal.
67.LP
68The value
69.I status
70is returned to the parent process as the process's exit status, and
71can be collected using one of the
0bfa087b 72.BR wait (2)
fea681da
MK
73family of calls.
74.LP
75The function
63aa9df0 76.BR _Exit ()
fea681da 77is equivalent to
63aa9df0 78.BR _exit ().
47297adb 79.SH RETURN VALUE
fea681da 80These functions do not return.
47297adb 81.SH CONFORMING TO
97c1eac8 82SVr4, POSIX.1-2001, 4.3BSD.
60a90ecd
MK
83The function
84.BR _Exit ()
85was introduced by C99.
fea681da
MK
86.SH NOTES
87For a discussion on the effects of an exit, the transmission of
078a7d6e 88exit status, zombie processes, signals sent, and so on, see
fea681da
MK
89.BR exit (3).
90.LP
91The function
63aa9df0 92.BR _exit ()
60a90ecd
MK
93is like
94.BR exit (3),
95but does not call any
7b57506d 96functions registered with
0bfa087b 97.BR atexit (3)
c13182ef 98or
0bfa087b 99.BR on_exit (3).
7b57506d 100Whether it flushes
fea681da
MK
101standard I/O buffers and removes temporary files created with
102.BR tmpfile (3)
a43eed0c 103is implementation-dependent.
fea681da 104On the other hand,
63aa9df0 105.BR _exit ()
fea681da 106does close open file descriptors, and this may cause an unknown delay,
c13182ef
MK
107waiting for pending output to finish.
108If the delay is undesired,
988db661 109it may be useful to call functions like
0bfa087b 110.BR tcflush (3)
60a90ecd
MK
111before calling
112.BR _exit ().
d9bfdb9c
MK
113Whether any pending I/O is canceled, and which pending I/O may be
114canceled upon
60a90ecd
MK
115.BR _exit (),
116is implementation-dependent.
9abeddb2
MK
117
118In glibc up to version 2.3, the
119.BR _exit ()
120wrapper function invoked the kernel system call of the same name.
121Since glibc 2.3, the wrapper function invokes
122.BR exit_group (2),
123in order to terminate all of the threads in a process.
47297adb 124.SH SEE ALSO
fea681da 125.BR execve (2),
f02720dd 126.BR exit_group (2),
fea681da
MK
127.BR fork (2),
128.BR kill (2),
129.BR wait (2),
130.BR wait4 (2),
131.BR waitpid (2),
7b57506d 132.BR atexit (3),
fea681da 133.BR exit (3),
7b57506d 134.BR on_exit (3),
fea681da 135.BR termios (3)