diff options
Diffstat (limited to 'src/lib/libc/stdlib/exit.3')
| -rw-r--r-- | src/lib/libc/stdlib/exit.3 | 75 |
1 files changed, 57 insertions, 18 deletions
diff --git a/src/lib/libc/stdlib/exit.3 b/src/lib/libc/stdlib/exit.3 index adb81ffcb4..e452d454a8 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.12 2011/11/17 14:26:14 schwarze 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 $Mdocdate: November 17 2011 $ |
| 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 | 47 | The |
| 51 | terminates a process. | 48 | .Fn exit |
| 49 | and | ||
| 50 | .Fn _Exit | ||
| 51 | functions terminate a process. | ||
| 52 | .Pp | 52 | .Pp |
| 53 | Before termination it performs the following functions in the | 53 | Before termination, |
| 54 | order listed: | 54 | .Fn exit |
| 55 | performs the following operations in the order listed: | ||
| 55 | .Bl -enum -offset indent | 56 | .Bl -enum -offset indent |
| 56 | .It | 57 | .It |
| 57 | Call the functions registered with the | 58 | Call the functions registered with the |
| @@ -66,19 +67,57 @@ Unlink all files created with the | |||
| 66 | .Xr tmpfile 3 | 67 | .Xr tmpfile 3 |
| 67 | function. | 68 | function. |
| 68 | .El | 69 | .El |
| 70 | .Pp | ||
| 71 | The | ||
| 72 | .Fn _Exit | ||
| 73 | function terminates without calling the functions registered with the | ||
| 74 | .Xr atexit 3 | ||
| 75 | function. | ||
| 76 | The | ||
| 77 | .Ox | ||
| 78 | implementation of | ||
| 79 | .Fn _Exit | ||
| 80 | does not flush open output streams or unlink files created with the | ||
| 81 | .Xr tmpfile 3 | ||
| 82 | function. | ||
| 83 | However, this behavior is implementation-specific. | ||
| 84 | .Pp | ||
| 85 | Lastly, | ||
| 86 | .Fn exit | ||
| 87 | and | ||
| 88 | .Fn _Exit | ||
| 89 | call | ||
| 90 | .Xr _exit 2 . | ||
| 91 | Note that typically | ||
| 92 | .Xr _exit 2 | ||
| 93 | only passes the lower 8 bits of | ||
| 94 | .Fa status | ||
| 95 | on to the parent, thus negative values have less meaning. | ||
| 69 | .Sh RETURN VALUES | 96 | .Sh RETURN VALUES |
| 70 | The | 97 | The |
| 71 | .Fn exit | 98 | .Fn exit |
| 72 | function | 99 | and |
| 73 | never returns. | 100 | .Fn _Exit |
| 101 | functions 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 |
| 80 | The | 109 | The |
| 81 | .Fn exit | 110 | .Fn exit |
| 82 | function | 111 | and |
| 83 | conforms to | 112 | .Fn _Exit |
| 84 | .St -ansiC . | 113 | functions conform to |
| 114 | .St -ansiC-99 . | ||
| 115 | .Sh HISTORY | ||
| 116 | An | ||
| 117 | .Fn exit | ||
| 118 | function first appeared as a system call in | ||
| 119 | .At v1 . | ||
| 120 | In | ||
| 121 | .At v7 , | ||
| 122 | the bare system call was renamed to | ||
| 123 | .Xr _exit 2 . | ||
