summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/atexit.c
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2013-12-28 18:38:42 +0000
committerkettenis <kettenis@openbsd.org>2013-12-28 18:38:42 +0000
commit859c67c82abbbc6a47fd83e1b7b5305186273ffd (patch)
treed7b22f6c7c4434d4f249ef2ef2afcbdede54f8ef /lib/libc/stdlib/atexit.c
parentBack out the previous commit; rodata gets merged with text by the linker. (diff)
downloadwireguard-openbsd-859c67c82abbbc6a47fd83e1b7b5305186273ffd.tar.xz
wireguard-openbsd-859c67c82abbbc6a47fd83e1b7b5305186273ffd.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 'lib/libc/stdlib/atexit.c')
-rw-r--r--lib/libc/stdlib/atexit.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/lib/libc/stdlib/atexit.c b/lib/libc/stdlib/atexit.c
index 52f1cf3c5c7..049da3261d8 100644
--- a/lib/libc/stdlib/atexit.c
+++ b/lib/libc/stdlib/atexit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atexit.c,v 1.16 2013/06/02 21:08:36 matthew Exp $ */
+/* $OpenBSD: atexit.c,v 1.17 2013/12/28 18:38:42 kettenis Exp $ */
/*
* Copyright (c) 2002 Daniel Hartmeier
* All rights reserved.
@@ -102,15 +102,6 @@ unlock:
}
/*
- * Register a function to be performed at exit.
- */
-int
-atexit(void (*func)(void))
-{
- return (__cxa_atexit((void (*)(void *))func, NULL, NULL));
-}
-
-/*
* Call all handlers registered with __cxa_atexit() for the shared
* object owning 'dso'.
* Note: if 'dso' is NULL, then all remaining handlers are called.