-mdoc (version 3)
[unix-history] / usr / src / lib / libc / stdlib / exit.3
.\" Copyright (c) 1990, 1991 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" %sccs.include.redist.man%
.\"
.\" @(#)exit.3 6.5 (Berkeley) %G%
.\"
.Dd
.Dt EXIT 3
.Os
.Sh NAME
.Nm exit
.Nd perform normal program termination
.Sh SYNOPSIS
.Fd #include <stdlib.h>
.Ft void
.Fn exit "int status"
.Sh DESCRIPTION
.Fn Exit
terminates a process.
.Pp
Before termination it performs the following functions in the
order listed:
.Bl -enum -offset indent
.It
Call the functions registered with the
.Xr atexit 3
function, in the reverse order of their registration.
.It
Flush all open output streams.
.It
Close all open streams.
.It
Unlink all files created with the
.Xr tmpfile 3
function.
.El
.Sh RETURN VALUES
The
.Fn exit
function
never returns.
.Sh SEE ALSO
.Xr _exit 2 ,
.Xr atexit 3 ,
.Xr intro 3 ,
.Xr tmpfile 3
.Sh STANDARDS
The
.Fn exit
function
conforms to
.St -ansiC .