xref: /original-bsd/lib/libc/sys/_exit.2 (revision 02e832b2)
1.\" Copyright (c) 1980 Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)_exit.2	6.7 (Berkeley) 09/02/92
7.\"
8.Dd
9.Dt _EXIT 2
10.Os BSD 4
11.Sh NAME
12.Nm _exit
13.Nd terminate the calling process
14.Sh SYNOPSIS
15.Fd #include <unistd.h>
16.Ft void volatile
17.Fn _exit "int status"
18.Sh DESCRIPTION
19The
20.Fn _exit
21function
22terminates a process with the following consequences:
23.Bl -bullet
24.It
25All of the descriptors open in the calling process are closed.
26This may entail delays, for example, waiting for output to drain;
27a process in this state may not be killed, as it is already dying.
28.It
29If the parent process of the calling process has an outstanding
30.Xr wait
31call
32or is interested in the
33.Dv SIGCHLD
34signal,
35it is notified of the calling process's termination and
36the
37.Em status
38area is set as defined by
39.Xr wait 2 .
40.It
41The parent process-ID of all of the calling process's existing child
42processes are set to 1; the initialization process
43(see the DEFINITIONS section of
44.Xr intro 2 )
45inherits each of these processes.
46Any stopped children are restarted with a hangup signal
47.Pq Dv SIGHUP .
48.El
49.Pp
50Most C programs call the library routine
51.Xr exit 3 ,
52which flushes buffers, closes streams, unlinks temporary files, etc.,
53before
54calling
55.Fn _exit .
56.Sh RETURN VALUE
57.Fn _exit
58can never return.
59.Sh SEE ALSO
60.Xr fork 2 ,
61.Xr sigvec 2 ,
62.Xr wait 2 ,
63.Xr exit 3
64.Sh HISTORY
65An
66.Nm exit
67function call appeared in
68.At v6 .
69