diff options
author | guenther <> | 2014-11-20 04:55:43 +0000 |
---|---|---|
committer | guenther <> | 2014-11-20 04:55:43 +0000 |
commit | 9a3a3e0abe3dbaf29a4781c95bb7ff180bd6a104 (patch) | |
tree | ff46ebe697e6625580087b6ef215141deb83dcee /src/lib | |
parent | e046cac318faebe2942c6f2fd17322437f620c61 (diff) | |
download | openbsd-9a3a3e0abe3dbaf29a4781c95bb7ff180bd6a104.tar.gz openbsd-9a3a3e0abe3dbaf29a4781c95bb7ff180bd6a104.tar.bz2 openbsd-9a3a3e0abe3dbaf29a4781c95bb7ff180bd6a104.zip |
Document behavior of atexit() when called in a DSO that is later unloaded.
Would be nice to document when/where this originated (in glibc?) if
anyone knows...
tweaks by schwarze@
ok jmc@ espie@ kettenis@ schwarze@ dimitry(at)google.com
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libc/stdlib/atexit.3 | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/lib/libc/stdlib/atexit.3 b/src/lib/libc/stdlib/atexit.3 index 8e3ac3e60f..c4f56c90fa 100644 --- a/src/lib/libc/stdlib/atexit.3 +++ b/src/lib/libc/stdlib/atexit.3 | |||
@@ -29,9 +29,9 @@ | |||
29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
30 | .\" SUCH DAMAGE. | 30 | .\" SUCH DAMAGE. |
31 | .\" | 31 | .\" |
32 | .\" $OpenBSD: atexit.3,v 1.9 2013/06/05 03:39:23 tedu Exp $ | 32 | .\" $OpenBSD: atexit.3,v 1.10 2014/11/20 04:55:43 guenther Exp $ |
33 | .\" | 33 | .\" |
34 | .Dd $Mdocdate: June 5 2013 $ | 34 | .Dd $Mdocdate: November 20 2014 $ |
35 | .Dt ATEXIT 3 | 35 | .Dt ATEXIT 3 |
36 | .Os | 36 | .Os |
37 | .Sh NAME | 37 | .Sh NAME |
@@ -55,6 +55,15 @@ no arguments are passed. | |||
55 | At least 32 functions can always be registered, | 55 | At least 32 functions can always be registered, |
56 | and more are allowed as long as sufficient memory can be allocated. | 56 | and more are allowed as long as sufficient memory can be allocated. |
57 | .Pp | 57 | .Pp |
58 | If a shared object is unloaded from process memory using | ||
59 | .Xr dlclose 3 , | ||
60 | then any functions registered by calling | ||
61 | .Fn atexit | ||
62 | from that shared object will be called in reverse order and unregistered. | ||
63 | Note that it is the source of the call to | ||
64 | .Fn atexit | ||
65 | that matters, not the source of the function that was registered. | ||
66 | .Pp | ||
58 | .Fn atexit | 67 | .Fn atexit |
59 | is very difficult to use correctly without creating | 68 | is very difficult to use correctly without creating |
60 | .Xr exit 3 Ns -time | 69 | .Xr exit 3 Ns -time |
@@ -75,3 +84,6 @@ The | |||
75 | .Fn atexit | 84 | .Fn atexit |
76 | function conforms to | 85 | function conforms to |
77 | .St -ansiC . | 86 | .St -ansiC . |
87 | .Pp | ||
88 | The behavior when a shared object is unloaded is an extension to | ||
89 | that standard. | ||