diff options
author | 2005-05-23 19:22:11 +0000 | |
---|---|---|
committer | 2005-05-23 19:22:11 +0000 | |
commit | a4baf06a268fa0406c3e8741ddb8ab7a79aff225 (patch) | |
tree | 784581e2039fc51de49b2ea0fd0a8f648cd57e7b | |
parent | pin the sample rate at 44.1k, PB's don't seem to get the 8k or 48k sample (diff) | |
download | wireguard-openbsd-a4baf06a268fa0406c3e8741ddb8ab7a79aff225.tar.xz wireguard-openbsd-a4baf06a268fa0406c3e8741ddb8ab7a79aff225.zip |
fixes for dlclose, ok kettenis@
-rw-r--r-- | libexec/ld.so/dlfcn.c | 31 | ||||
-rw-r--r-- | libexec/ld.so/library.c | 9 | ||||
-rw-r--r-- | libexec/ld.so/library_mquery.c | 11 | ||||
-rw-r--r-- | libexec/ld.so/library_subr.c | 12 |
4 files changed, 17 insertions, 46 deletions
diff --git a/libexec/ld.so/dlfcn.c b/libexec/ld.so/dlfcn.c index 1df2329e36b..72c7400ffb8 100644 --- a/libexec/ld.so/dlfcn.c +++ b/libexec/ld.so/dlfcn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dlfcn.c,v 1.47 2005/05/10 03:36:07 drahn Exp $ */ +/* $OpenBSD: dlfcn.c,v 1.48 2005/05/23 19:22:11 drahn Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -41,9 +41,8 @@ int _dl_errno; 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); +static elf_object_t *obj_from_addr(const void *addr); void * dlopen(const char *libname, int flags) @@ -246,35 +245,13 @@ _dl_real_close(void *handle) return (1); } - if (object->refcount == 1) { - if (dynobj->dep_next) - _dl_unload_deps(dynobj); - } - _dl_unlink_dlopen(object); + _dl_notify_unload_shlib(object); + _dl_run_all_dtors(); _dl_unload_shlib(object); return (0); } -/* - * Scan through the shadow dep list and 'unload' every library - * we depend upon. Shadow objects are removed when removing ourself. - */ -void -_dl_unload_deps(elf_object_t *object) -{ - elf_object_t *depobj; - - depobj = object->dep_next; - while (depobj) { - if (depobj->next->refcount == 1) { /* This object will go away */ - if (depobj->next->dep_next) - _dl_unload_deps(depobj->next); - _dl_unload_shlib(depobj->next); - } - depobj = depobj->dep_next; - } -} /* * Return a character string describing the last dl... error occurred. diff --git a/libexec/ld.so/library.c b/libexec/ld.so/library.c index b1b3895b91d..37b5eed57f0 100644 --- a/libexec/ld.so/library.c +++ b/libexec/ld.so/library.c @@ -1,4 +1,4 @@ -/* $OpenBSD: library.c,v 1.39 2005/05/10 03:36:07 drahn Exp $ */ +/* $OpenBSD: library.c,v 1.40 2005/05/23 19:22:11 drahn Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -55,13 +55,6 @@ _dl_load_list_free(struct load_list *load_list) } void -_dl_notify_unload_shlib(elf_object_t *object) -{ - if (--object->refcount == 0) { - _dl_run_dtors(object); - } -} -void _dl_unload_shlib(elf_object_t *object) { if (object->refcount == 0) { diff --git a/libexec/ld.so/library_mquery.c b/libexec/ld.so/library_mquery.c index 300978e4372..e01361df8e1 100644 --- a/libexec/ld.so/library_mquery.c +++ b/libexec/ld.so/library_mquery.c @@ -1,4 +1,4 @@ -/* $OpenBSD: library_mquery.c,v 1.19 2005/05/10 03:36:07 drahn Exp $ */ +/* $OpenBSD: library_mquery.c,v 1.20 2005/05/23 19:22:11 drahn Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -58,15 +58,6 @@ _dl_load_list_free(struct load_list *load_list) } } -void -_dl_notify_unload_shlib(elf_object_t *object) -{ - struct dep_node *n; - - if (--object->refcount == 0) - for (n = object->first_child; n; n = n->next_sibling) - _dl_notify_unload_shlib(n->data); -} void _dl_unload_shlib(elf_object_t *object) diff --git a/libexec/ld.so/library_subr.c b/libexec/ld.so/library_subr.c index 07f69f9e24b..c2e7d8f8e81 100644 --- a/libexec/ld.so/library_subr.c +++ b/libexec/ld.so/library_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: library_subr.c,v 1.4 2005/05/10 03:36:07 drahn Exp $ */ +/* $OpenBSD: library_subr.c,v 1.5 2005/05/23 19:22:11 drahn Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -388,6 +388,16 @@ _dl_unlink_dlopen(elf_object_t *dep) } void +_dl_notify_unload_shlib(elf_object_t *object) +{ + struct dep_node *n; + + if (--object->refcount == 0) + for (n = object->first_child; n; n = n->next_sibling) + _dl_notify_unload_shlib(n->data); +} + +void _dl_unload_dlopen(void) { if (_dlopened_first_child != NULL) |