diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2005-04-05 19:29:10 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2005-04-05 19:29:10 +0000 |
commit | 89c5196820bb38412fa7d291f3a10dd4dfbda71d (patch) | |
tree | 6687cb51539366828e7a33bcb0229a721a47b267 /libexec/ld.so/dlfcn.c | |
parent | ec2a10f3444e39a36e94bccf99c9b3ffaf76695e (diff) |
Do a better job of running destructors in the right order.
Diffstat (limited to 'libexec/ld.so/dlfcn.c')
-rw-r--r-- | libexec/ld.so/dlfcn.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/libexec/ld.so/dlfcn.c b/libexec/ld.so/dlfcn.c index fff632ee745..2826cdf8cf4 100644 --- a/libexec/ld.so/dlfcn.c +++ b/libexec/ld.so/dlfcn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dlfcn.c,v 1.44 2005/03/08 20:01:59 drahn Exp $ */ +/* $OpenBSD: dlfcn.c,v 1.45 2005/04/05 19:29:09 drahn Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -40,12 +40,10 @@ int _dl_errno; -static int _dl_real_close(void *handle); -static void _dl_unload_deps(elf_object_t *object); -static void _dl_thread_kern_stop(void); -static void _dl_thread_kern_go(void); -static void (*_dl_thread_fnc)(int) = NULL; -static elf_object_t *obj_from_addr(const void *addr); +int _dl_real_close(void *handle); +void _dl_unload_deps(elf_object_t *object); +void (*_dl_thread_fnc)(int) = NULL; +elf_object_t *obj_from_addr(const void *addr); void * dlopen(const char *libname, int flags) @@ -113,6 +111,9 @@ dlopen(const char *libname, int flags) _dl_rtld(object); _dl_call_init(object); + _dl_link_dlopen(object); + + if (_dl_debug_map->r_brk) { _dl_debug_map->r_state = RT_ADD; (*((void (*)(void))_dl_debug_map->r_brk))(); @@ -229,7 +230,7 @@ dlclose(void *handle) return (retval); } -static int +int _dl_real_close(void *handle) { elf_object_t *object; @@ -250,6 +251,7 @@ _dl_real_close(void *handle) _dl_unload_deps(dynobj); } + _dl_unlink_dlopen(object); _dl_unload_shlib(object); return (0); } @@ -258,7 +260,7 @@ _dl_real_close(void *handle) * Scan through the shadow dep list and 'unload' every library * we depend upon. Shadow objects are removed when removing ourself. */ -static void +void _dl_unload_deps(elf_object_t *object) { elf_object_t *depobj; @@ -379,14 +381,14 @@ _dl_show_objects(void) _dl_symcachestat_lookups)); } -static void +void _dl_thread_kern_stop(void) { if (_dl_thread_fnc != NULL) (*_dl_thread_fnc)(0); } -static void +void _dl_thread_kern_go(void) { if (_dl_thread_fnc != NULL) |