Commit | Line | Data |
---|---|---|
5623bdc2 | 1 | .\" Copyright (c) 1980 Regents of the University of California. |
931b8415 | 2 | .\" All rights reserved. |
5623bdc2 | 3 | .\" |
931b8415 | 4 | .\" %sccs.include.redist.man% |
5623bdc2 | 5 | .\" |
5ea86a1c | 6 | .\" @(#)_exit.2 6.6 (Berkeley) %G% |
931b8415 | 7 | .\" |
931b8415 | 8 | .Dd |
5ea86a1c | 9 | .Dt EXIT 2 |
931b8415 CL |
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 | |
19 | The | |
20 | .Fn _exit | |
21 | function | |
69ee3f0e | 22 | terminates a process with the following consequences: |
931b8415 CL |
23 | .Bl -bullet |
24 | .It | |
69ee3f0e | 25 | All of the descriptors open in the calling process are closed. |
d4bad45b | 26 | This may entail delays, for example, waiting for output to drain; |
770b99be | 27 | a process in this state may not be killed, as it is already dying. |
931b8415 CL |
28 | .It |
29 | If the parent process of the calling process has an outstanding | |
30 | .Xr wait | |
31 | call | |
32 | or is interested in the | |
33 | .Dv SIGCHLD | |
34 | signal, | |
35 | it is notified of the calling process's termination and | |
36 | the | |
37 | .Em status | |
38 | area is set as defined by | |
39 | .Xr wait 2 . | |
40 | .It | |
41 | The parent process-ID of all of the calling process's existing child | |
42 | processes are set to 1; the initialization process | |
43 | (see the DEFINITIONS section of | |
44 | .Xr intro 2 ) | |
45 | inherits each of these processes. | |
46 | Any stopped children are restarted with a hangup signal | |
47 | .Pq Dv SIGHUP . | |
48 | .El | |
49 | .Pp | |
69ee3f0e | 50 | Most C programs call the library routine |
931b8415 CL |
51 | .Xr exit 3 , |
52 | which flushes buffers, closes streams, unlinks temporary files, etc., | |
53 | before | |
54 | calling | |
55 | .Fn _exit . | |
56 | .Sh RETURN VALUE | |
57 | .Fn _exit | |
58 | can 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 | |
65 | An | |
66 | .Nm exit | |
5ea86a1c CL |
67 | function call appeared in |
68 | .At v6 . |