Loading...
--- Libc/Libc-262.3.2/stdlib/atexit.3
+++ Libc/Libc-498/stdlib/atexit.3
@@ -34,9 +34,9 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)atexit.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdlib/atexit.3,v 1.7 2001/09/07 14:46:35 asmodai Exp $
+.\" $FreeBSD: src/lib/libc/stdlib/atexit.3,v 1.10 2002/12/18 13:33:03 ru Exp $
.\"
-.Dd June 4, 1993
+.Dd September 6, 2002
.Dt ATEXIT 3
.Os
.Sh NAME
@@ -47,21 +47,33 @@
.Sh SYNOPSIS
.In stdlib.h
.Ft int
-.Fn atexit "void (*function)(void)"
+.Fn atexit "void (*func)(void)"
.Sh DESCRIPTION
The
.Fn atexit
function
-registers the given
-.Ar function
+registers the function
+.Fa func
to be called at program exit, whether via
.Xr exit 3
or via return from the program's
-.Em main .
+.Fn main .
Functions so registered are called in reverse order;
no arguments are passed.
-At least 32 functions can always be registered,
-and more are allowed as long as sufficient memory can be allocated.
+.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;
+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