summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/exit.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/stdlib/exit.3')
-rw-r--r--src/lib/libc/stdlib/exit.366
1 files changed, 48 insertions, 18 deletions
diff --git a/src/lib/libc/stdlib/exit.3 b/src/lib/libc/stdlib/exit.3
index adb81ffcb4..fa233ac75f 100644
--- a/src/lib/libc/stdlib/exit.3
+++ b/src/lib/libc/stdlib/exit.3
@@ -13,11 +13,7 @@
13.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\" notice, this list of conditions and the following disclaimer in the 14.\" notice, this list of conditions and the following disclaimer in the
15.\" documentation and/or other materials provided with the distribution. 15.\" documentation and/or other materials provided with the distribution.
16.\" 3. All advertising materials mentioning features or use of this software 16.\" 3. Neither the name of the University nor the names of its contributors
17.\" must display the following acknowledgement:
18.\" This product includes software developed by the University of
19.\" California, Berkeley and its contributors.
20.\" 4. Neither the name of the University nor the names of its contributors
21.\" may be used to endorse or promote products derived from this software 17.\" may be used to endorse or promote products derived from this software
22.\" without specific prior written permission. 18.\" without specific prior written permission.
23.\" 19.\"
@@ -33,25 +29,30 @@
33.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34.\" SUCH DAMAGE. 30.\" SUCH DAMAGE.
35.\" 31.\"
36.\" from: @(#)exit.3 6.6 (Berkeley) 6/29/91 32.\" $OpenBSD: exit.3,v 1.10 2004/05/03 17:21:13 millert Exp $
37.\" $Id: exit.3,v 1.1.1.1 1995/10/18 08:42:17 deraadt Exp $
38.\" 33.\"
39.Dd June 29, 1991 34.Dd January 21, 2004
40.Dt EXIT 3 35.Dt EXIT 3
41.Os 36.Os
42.Sh NAME 37.Sh NAME
43.Nm exit 38.Nm exit, _Exit
44.Nd perform normal program termination 39.Nd perform normal program termination
45.Sh SYNOPSIS 40.Sh SYNOPSIS
46.Fd #include <stdlib.h> 41.Fd #include <stdlib.h>
47.Ft void 42.Ft void
48.Fn exit "int status" 43.Fn exit "int status"
44.Ft void
45.Fn _Exit "int status"
49.Sh DESCRIPTION 46.Sh DESCRIPTION
50.Fn Exit 47The
51terminates a process. 48.Fn exit
49and
50.Fn _Exit
51functions terminate a process.
52.Pp 52.Pp
53Before termination it performs the following functions in the 53Before termination,
54order listed: 54.Fn exit
55performs the following operations in the order listed:
55.Bl -enum -offset indent 56.Bl -enum -offset indent
56.It 57.It
57Call the functions registered with the 58Call the functions registered with the
@@ -66,19 +67,48 @@ Unlink all files created with the
66.Xr tmpfile 3 67.Xr tmpfile 3
67function. 68function.
68.El 69.El
70.Pp
71The
72.Fn _Exit
73function terminates without calling the functions registered with the
74.Xr atexit 3
75function.
76The
77.Ox
78implementation of
79.Fn _Exit
80does not flush open output streams or unlink files created with the
81.Xr tmpfile 3
82function.
83However, this behavior is implementation-specific.
84.Pp
85Lastly,
86.Fn exit
87and
88.Fn _Exit
89call
90.Xr _exit 2 .
91Note that typically
92.Xr _exit 2
93only passes the lower 8 bits of
94.Fa status
95on to the parent, thus negative values have less meaning.
69.Sh RETURN VALUES 96.Sh RETURN VALUES
70The 97The
71.Fn exit 98.Fn exit
72function 99and
73never returns. 100.Fn _Exit
101functions never return.
74.Sh SEE ALSO 102.Sh SEE ALSO
75.Xr _exit 2 , 103.Xr _exit 2 ,
76.Xr atexit 3 , 104.Xr atexit 3 ,
77.Xr intro 3 , 105.Xr intro 3 ,
106.Xr sysexits 3 ,
78.Xr tmpfile 3 107.Xr tmpfile 3
79.Sh STANDARDS 108.Sh STANDARDS
80The 109The
81.Fn exit 110.Fn exit
82function 111and
83conforms to 112.Fn _Exit
84.St -ansiC . 113functions conform to
114.St -ansiC-99 .