gno/usr.man/man3/exit.3
1997-02-27 07:32:31 +00:00

117 lines
3.5 KiB
Groff

.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" the American National Standards Committee X3, on Information
.\" Processing Systems.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)exit.3 8.1 (Berkeley) 6/4/93
.\"
.TH EXIT 3 "22 January 1997" GNO "Library Routines"
.SH NAME
.BR exit ,
.BR _exit ,
.BR rexit
\- perform normal program termination
.SH SYNOPSIS
#include <stdlib.h>
.sp 1
void
\fBexit\fR (int \fIstatus\fR);
.br
void
\fBrexit\fR (int \fIstatus\fR);
.sp 1
#include <unistd.h>
.sp 1
void
\fB_exit\fR (int \fIstatus\fR);
.SH DESCRIPTION
.BR exit
terminates a process.
.LP
Before termination
.BR exit
performs the following functions in the order listed:
.RS
.sp 1
Call the functions registered with the
.BR atexit (3)
function, in the reverse order of their registration.
.sp 1
Flush all open output streams.
.sp 1
Close all open streams.
.sp 1
Unlink all files created with the
.BR tmpfile (3)
function.
.RE
.LP
.BR rexit
is identical to
.BR exit ,
except that the process image will be flagged to GS/OS as restartable.
.LP
.BR _exit
is similar to
.BR exit ,
except that no clean up is done except for the flushing and closing of
any open streams.
.BR _exit
is the proper function to call when a child process exits while still
executing in the address space of its parent process, such as after
a failed
.BR execve (2)
call.
.LP
Passing arbitrary values back to the environment as
.BR status
is considered bad style. Instead, use the values as described in
.BR sysexits (3).
.SH RETURN VALUES
The
.BR exit
function
never returns.
.SH SEE ALSO
.BR atexit (3),
.BR intro (3),
.BR tmpfile (3),
.BR sysexits (3)
.SH STANDARDS
The
.BR exit
function
conforms to ANSI/C. The
.BR _exit
function is defined by POSIX 1003.1-88.