Include some verbage about not calling exit() from functions registered

by atexit().
This commit is contained in:
Garrett Wollman 2002-09-06 19:23:28 +00:00
parent 99b57e408b
commit 2c5db8c62d
2 changed files with 24 additions and 2 deletions

View File

@ -36,7 +36,7 @@
.\" @(#)atexit.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
.Dd June 4, 1993
.Dd September 6, 2002
.Dt ATEXIT 3
.Os
.Sh NAME
@ -60,8 +60,19 @@ or via return from the program's
.Em main .
Functions so registered are called in reverse order;
no arguments are passed.
.Pp
These functions must not call
.Fn exit ;
if it should be necessary to terminate the process while in such a
function, the
.Xr _exit 2
function should be used. (Alternatively, the function may cause abnormal
process termination, for example by calling
.Xr abort 3 . )
.Pp
At least 32 functions can always be registered,
and more are allowed as long as sufficient memory can be allocated.
.\" XXX {ATEXIT_MAX} is not implemented yet
.Sh RETURN VALUES
.Rv -std atexit
.Sh ERRORS

View File

@ -36,7 +36,7 @@
.\" @(#)exit.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
.Dd June 4, 1993
.Dd September 6, 2002
.Dt EXIT 3
.Os
.Sh NAME
@ -79,6 +79,17 @@ and
If portability is not a concern, you may
use the values described in
.Xr sysexits 3 .
.Pp
Note that
.Fn exit
does nothing to prevent bottomless recursion should a function registered
using
.Xr atexit 3
itself call
.Fn exit .
Such functions should call
.Xr _exit 2
instead (although this has other effects as well which may not be desired).
.Sh RETURN VALUES
The
.Fn exit