diff options
author | Ulrich Drepper <drepper@redhat.com> | 2006-10-27 20:14:53 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2006-10-27 20:14:53 +0000 |
commit | 131c4428c67c1147961cfbb8dbcb39a4b341d63f (patch) | |
tree | 461ef3db842de404178d255e638460811db16bfd /elf | |
parent | 4de0b4abf567b94997ee99c55d64a4e6aacfa4ea (diff) | |
download | glibc-131c4428c67c1147961cfbb8dbcb39a4b341d63f.zip glibc-131c4428c67c1147961cfbb8dbcb39a4b341d63f.tar.gz glibc-131c4428c67c1147961cfbb8dbcb39a4b341d63f.tar.bz2 |
* elf/dl-close.c (_dl_close_worker): Renamed from _dl_close and
split out locking and parameter checking.
(_dl_close): Call _dl_close_worker after locking and checking.
* elf/dl-open.c (_dl_open): Call _dl_close_worker instead of
_dl_close.
we are sure we do not need it anymore for _dl_close. Also move
* elf/dl-lookup.c (_dl_debug_bindings): Remove unused symbol_scope
Diffstat (limited to 'elf')
-rw-r--r-- | elf/dl-close.c | 36 | ||||
-rw-r--r-- | elf/dl-open.c | 2 |
2 files changed, 26 insertions, 12 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c index 31bc80b..51f813d 100644 --- a/elf/dl-close.c +++ b/elf/dl-close.c @@ -107,19 +107,10 @@ remove_slotinfo (size_t idx, struct dtv_slotinfo_list *listp, size_t disp, void -_dl_close (void *_map) +_dl_close_worker (struct link_map *map) { - struct link_map *map = _map; Lmid_t ns = map->l_ns; unsigned int i; - /* First see whether we can remove the object at all. */ - if (__builtin_expect (map->l_flags_1 & DF_1_NODELETE, 0) - && map->l_init_called) - /* Nope. Do nothing. */ - return; - - if (__builtin_expect (map->l_direct_opencount, 1) == 0) - GLRO(dl_signal_error) (0, map->l_name, NULL, N_("shared object not open")); /* Acquire the lock. */ __rtld_lock_lock_recursive (GL(dl_load_lock)); @@ -143,7 +134,6 @@ _dl_close (void *_map) _dl_debug_printf ("\nclosing file=%s; direct_opencount=%u\n", map->l_name, map->l_direct_opencount); - __rtld_lock_unlock_recursive (GL(dl_load_lock)); return; } @@ -698,6 +688,30 @@ _dl_close (void *_map) goto retry; dl_close_state = not_pending; +} + + +void +_dl_close (void *_map) +{ + struct link_map *map = _map; + + /* First see whether we can remove the object at all. */ + if (__builtin_expect (map->l_flags_1 & DF_1_NODELETE, 0)) + { + assert (map->l_init_called); + /* Nope. Do nothing. */ + return; + } + + if (__builtin_expect (map->l_direct_opencount, 1) == 0) + GLRO(dl_signal_error) (0, map->l_name, NULL, N_("shared object not open")); + + /* Acquire the lock. */ + __rtld_lock_lock_recursive (GL(dl_load_lock)); + + _dl_close_worker (map); + __rtld_lock_unlock_recursive (GL(dl_load_lock)); } diff --git a/elf/dl-open.c b/elf/dl-open.c index 2a891f2..c28b6b1 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -586,7 +586,7 @@ no more namespaces available for dlmopen()")); GL(dl_tls_dtv_gaps) = true; #endif - _dl_close (args.map); + _dl_close_worker (args.map); } assert (_dl_debug_initialize (0, args.nsid)->r_state == RT_CONSISTENT); |