OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / original / man2 / _exit.2
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.
14 .\"
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.
22 .\"
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 .\"
29 .TH _EXIT 2 2008-11-27 "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 .BR _Exit ():
47 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE; or
48 .I cc\ -std=c99
49 .SH DESCRIPTION
50 The function
51 .BR _exit ()
52 terminates the calling process "immediately".
53 Any open file descriptors
54 belonging to the process are closed; any children of the process are
55 inherited by process 1,
56 .IR init ,
57 and the process's parent is sent a
58 .B SIGCHLD
59 signal.
60 .LP
61 The value
62 .I status
63 is returned to the parent process as the process's exit status, and
64 can be collected using one of the
65 .BR wait (2)
66 family of calls.
67 .LP
68 The function
69 .BR _Exit ()
70 is equivalent to
71 .BR _exit ().
72 .SH "RETURN VALUE"
73 These functions do not return.
74 .SH "CONFORMING TO"
75 SVr4, POSIX.1-2001, 4.3BSD.
76 The function
77 .BR _Exit ()
78 was introduced by C99.
79 .SH NOTES
80 For a discussion on the effects of an exit, the transmission of
81 exit status, zombie processes, signals sent, etc., see
82 .BR exit (3).
83 .LP
84 The function
85 .BR _exit ()
86 is like
87 .BR exit (3),
88 but does not call any
89 functions registered with
90 .BR atexit (3)
91 or
92 .BR on_exit (3).
93 Whether it flushes
94 standard I/O buffers and removes temporary files created with
95 .BR tmpfile (3)
96 is implementation-dependent.
97 On the other hand,
98 .BR _exit ()
99 does close open file descriptors, and this may cause an unknown delay,
100 waiting for pending output to finish.
101 If the delay is undesired,
102 it may be useful to call functions like
103 .BR tcflush (3)
104 before calling
105 .BR _exit ().
106 Whether any pending I/O is canceled, and which pending I/O may be
107 canceled upon
108 .BR _exit (),
109 is implementation-dependent.
110
111 In glibc up to version 2.3, the
112 .BR _exit ()
113 wrapper function invoked the kernel system call of the same name.
114 Since glibc 2.3, the wrapper function invokes
115 .BR exit_group (2),
116 in order to terminate all of the threads in a process.
117 .SH "SEE ALSO"
118 .BR execve (2),
119 .BR exit_group (2),
120 .BR fork (2),
121 .BR kill (2),
122 .BR wait (2),
123 .BR wait4 (2),
124 .BR waitpid (2),
125 .BR atexit (3),
126 .BR exit (3),
127 .BR on_exit (3),
128 .BR termios (3)