aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-open.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-10-24 07:36:55 +0000
committerUlrich Drepper <drepper@redhat.com>2000-10-24 07:36:55 +0000
commit42c4f32a44c76d1f4e2b744bf80f495dc36caa87 (patch)
tree475224614ae3e30c27dc1889e86468080c48cf9c /elf/dl-open.c
parent69c3325490f56db660b349d7c04daab6aaea1bf1 (diff)
downloadglibc-42c4f32a44c76d1f4e2b744bf80f495dc36caa87.tar
glibc-42c4f32a44c76d1f4e2b744bf80f495dc36caa87.tar.gz
glibc-42c4f32a44c76d1f4e2b744bf80f495dc36caa87.tar.bz2
glibc-42c4f32a44c76d1f4e2b744bf80f495dc36caa87.zip
Update.
2000-10-24 Ulrich Drepper <drepper@redhat.com> Complete revamp of the reference counter handling. * include/link.h (struct link_map): Add l_idx field. * elf/dl-close.c: Handle decrementing of reference counters more correctly. If necessary decrement reference counters of dependencies of dependencies. * elf/dl-lookup.c (add_dependency): Only increment reference counter of the object itself and not also its dependencies. * elf/dl-open.c: Increment reference counters here. * elf/dl-deps.c: Remove reference counter handling here. * elf/dl-load.c: Likewise. * elf/rtld.c: Adjust for _dl_map_deps not handling reference counters. * elf/loadtest.c: Print loaded objects at the beginning.
Diffstat (limited to 'elf/dl-open.c')
-rw-r--r--elf/dl-open.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 5c078d9be8..b278e2043e 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -238,7 +238,8 @@ dl_open_worker (void *a)
return;
}
- if (new->l_searchlist.r_list)
+ /* It was already open. */
+ if (new->l_searchlist.r_list != NULL)
{
/* Let the user know about the opencount. */
if (__builtin_expect (_dl_debug_files, 0))
@@ -259,13 +260,19 @@ dl_open_worker (void *a)
if ((mode & RTLD_GLOBAL) && new->l_global == 0)
(void) add_to_global (new);
- /* It was already open. */
+ /* Increment just the reference counter of the object. */
+ ++new->l_opencount;
+
return;
}
/* Load that object's dependencies. */
_dl_map_object_deps (new, NULL, 0, 0);
+ /* Increment the open count for all dependencies. */
+ for (i = 0; i < new->l_searchlist.r_nlist; ++i)
+ ++new->l_searchlist.r_list[i]->l_opencount;
+
/* So far, so good. Now check the versions. */
for (i = 0; i < new->l_searchlist.r_nlist; ++i)
if (new->l_searchlist.r_list[i]->l_versions == NULL)