summaryrefslogtreecommitdiff
path: root/src/lib/libc
diff options
context:
space:
mode:
authorkettenis <>2013-12-28 18:38:42 +0000
committerkettenis <>2013-12-28 18:38:42 +0000
commit466b5427ac698897c6653527fee5803e78882ff3 (patch)
tree938d46655895003567e488cc45a151e8240a82ab /src/lib/libc
parentcb7c5dafb56feec1bf690b3a2894c6661680a6cb (diff)
downloadopenbsd-466b5427ac698897c6653527fee5803e78882ff3.tar.gz
openbsd-466b5427ac698897c6653527fee5803e78882ff3.tar.bz2
openbsd-466b5427ac698897c6653527fee5803e78882ff3.zip
Move atexit(3) into crtbegin.c and certbeginS.c such that we can pass the
right __dso_handle and have dlopen'ed shared objects run their atexit handlers when they get unloaded. This is what Linux does, and several ports depend on this behaviour (and will crash upon exit without this chang). Based on an earlier diff from matthew@ Tested by ajacoutot@ ok deraadt@
Diffstat (limited to 'src/lib/libc')
-rw-r--r--src/lib/libc/stdlib/atexit.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/lib/libc/stdlib/atexit.c b/src/lib/libc/stdlib/atexit.c
index 52f1cf3c5c..049da3261d 100644
--- a/src/lib/libc/stdlib/atexit.c
+++ b/src/lib/libc/stdlib/atexit.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: atexit.c,v 1.16 2013/06/02 21:08:36 matthew Exp $ */ 1/* $OpenBSD: atexit.c,v 1.17 2013/12/28 18:38:42 kettenis Exp $ */
2/* 2/*
3 * Copyright (c) 2002 Daniel Hartmeier 3 * Copyright (c) 2002 Daniel Hartmeier
4 * All rights reserved. 4 * All rights reserved.
@@ -102,15 +102,6 @@ unlock:
102} 102}
103 103
104/* 104/*
105 * Register a function to be performed at exit.
106 */
107int
108atexit(void (*func)(void))
109{
110 return (__cxa_atexit((void (*)(void *))func, NULL, NULL));
111}
112
113/*
114 * Call all handlers registered with __cxa_atexit() for the shared 105 * Call all handlers registered with __cxa_atexit() for the shared
115 * object owning 'dso'. 106 * object owning 'dso'.
116 * Note: if 'dso' is NULL, then all remaining handlers are called. 107 * Note: if 'dso' is NULL, then all remaining handlers are called.