diff options
author | wollman <wollman@FreeBSD.org> | 2002-09-06 19:23:28 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 2002-09-06 19:23:28 +0000 |
commit | 7c1e59f51dc419e96a4c8d9dd0b2f0e21b7223ce (patch) | |
tree | ab253f97e2e697b776a8effe176e15455cf1d674 | |
parent | 5f9cb58d07cea98610077a8d6da2e0638b11336f (diff) | |
download | FreeBSD-src-7c1e59f51dc419e96a4c8d9dd0b2f0e21b7223ce.zip FreeBSD-src-7c1e59f51dc419e96a4c8d9dd0b2f0e21b7223ce.tar.gz |
Include some verbage about not calling exit() from functions registered
by atexit().
-rw-r--r-- | lib/libc/stdlib/atexit.3 | 13 | ||||
-rw-r--r-- | lib/libc/stdlib/exit.3 | 13 |
2 files changed, 24 insertions, 2 deletions
diff --git a/lib/libc/stdlib/atexit.3 b/lib/libc/stdlib/atexit.3 index 7bb1ff6..cc434cc 100644 --- a/lib/libc/stdlib/atexit.3 +++ b/lib/libc/stdlib/atexit.3 @@ -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 diff --git a/lib/libc/stdlib/exit.3 b/lib/libc/stdlib/exit.3 index f94d199..bbe0d1f 100644 --- a/lib/libc/stdlib/exit.3 +++ b/lib/libc/stdlib/exit.3 @@ -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 |