OSDN Git Service

LDP: Update original to LDP v3.68
[linuxjm/LDP_man-pages.git] / original / man2 / _exit.2
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 2010-09-20 "Linux" "Linux Programmer's Manual"
30 .SH NAME
31 _exit, _Exit \- terminate the calling process
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 );
40 .sp
41 .in -4n
42 Feature Test Macro Requirements for glibc (see
43 .BR feature_test_macros (7)):
44 .in
45 .sp
46 .ad l
47 .BR _Exit ():
48 .RS 4
49 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
50 _POSIX_C_SOURCE\ >=\ 200112L;
51 .br
52 or
53 .I cc\ -std=c99
54 .RE
55 .ad
56 .SH DESCRIPTION
57 The function
58 .BR _exit ()
59 terminates the calling process "immediately".
60 Any open file descriptors
61 belonging to the process are closed; any children of the process are
62 inherited by process 1,
63 .IR init ,
64 and the process's parent is sent a
65 .B SIGCHLD
66 signal.
67 .LP
68 The value
69 .I status
70 is returned to the parent process as the process's exit status, and
71 can be collected using one of the
72 .BR wait (2)
73 family of calls.
74 .LP
75 The function
76 .BR _Exit ()
77 is equivalent to
78 .BR _exit ().
79 .SH RETURN VALUE
80 These functions do not return.
81 .SH CONFORMING TO
82 SVr4, POSIX.1-2001, 4.3BSD.
83 The function
84 .BR _Exit ()
85 was introduced by C99.
86 .SH NOTES
87 For a discussion on the effects of an exit, the transmission of
88 exit status, zombie processes, signals sent, and so on, see
89 .BR exit (3).
90 .LP
91 The function
92 .BR _exit ()
93 is like
94 .BR exit (3),
95 but does not call any
96 functions registered with
97 .BR atexit (3)
98 or
99 .BR on_exit (3).
100 Whether it flushes
101 standard I/O buffers and removes temporary files created with
102 .BR tmpfile (3)
103 is implementation-dependent.
104 On the other hand,
105 .BR _exit ()
106 does close open file descriptors, and this may cause an unknown delay,
107 waiting for pending output to finish.
108 If the delay is undesired,
109 it may be useful to call functions like
110 .BR tcflush (3)
111 before calling
112 .BR _exit ().
113 Whether any pending I/O is canceled, and which pending I/O may be
114 canceled upon
115 .BR _exit (),
116 is implementation-dependent.
117
118 In glibc up to version 2.3, the
119 .BR _exit ()
120 wrapper function invoked the kernel system call of the same name.
121 Since glibc 2.3, the wrapper function invokes
122 .BR exit_group (2),
123 in order to terminate all of the threads in a process.
124 .SH SEE ALSO
125 .BR execve (2),
126 .BR exit_group (2),
127 .BR fork (2),
128 .BR kill (2),
129 .BR wait (2),
130 .BR wait4 (2),
131 .BR waitpid (2),
132 .BR atexit (3),
133 .BR exit (3),
134 .BR on_exit (3),
135 .BR termios (3)
136 .SH COLOPHON
137 This page is part of release 3.68 of the Linux
138 .I man-pages
139 project.
140 A description of the project,
141 information about reporting bugs,
142 and the latest version of this page,
143 can be found at
144 \%http://www.kernel.org/doc/man\-pages/.