Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/ld.elf_so Change _rtld_dlclose() to unload the objec...



details:   https://anonhg.NetBSD.org/src/rev/896542627441
branches:  trunk
changeset: 481845:896542627441
user:      kleink <kleink%NetBSD.org@localhost>
date:      Mon Feb 07 19:02:49 2000 +0000

description:
Change _rtld_dlclose() to unload the object via _rtld_unload_object() rather
than by itself.  Besides being duplicated code the open-coded version
also did not take care of cleaning up after the object's DAG(!).
Fixes PR bin/8905.

diffstat:

 libexec/ld.elf_so/rtld.c |  32 ++------------------------------
 1 files changed, 2 insertions(+), 30 deletions(-)

diffs (47 lines):

diff -r 8f241bd5a533 -r 896542627441 libexec/ld.elf_so/rtld.c
--- a/libexec/ld.elf_so/rtld.c  Mon Feb 07 18:51:02 2000 +0000
+++ b/libexec/ld.elf_so/rtld.c  Mon Feb 07 19:02:49 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtld.c,v 1.28 1999/12/13 09:09:34 christos Exp $        */
+/*     $NetBSD: rtld.c,v 1.29 2000/02/07 19:02:49 kleink Exp $  */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -600,36 +600,8 @@
        _rtld_debug_state();
 
        --root->dl_refcount;
-       _rtld_unref_dag(root);
-       if (root->refcount == 0) {      /* We are finished with some objects. */
-               Obj_Entry      *obj;
-               Obj_Entry     **linkp;
-
-               /* Finalize objects that are about to be unmapped. */
-               for (obj = _rtld_objlist->next; obj != NULL; obj = obj->next)
-                       if (obj->refcount == 0 && obj->fini != NULL)
-                               (*obj->fini) ();
+       _rtld_unload_object(root, true);
 
-               /* Unmap all objects that are no longer referenced. */
-               linkp = &_rtld_objlist->next;
-               while ((obj = *linkp) != NULL) {
-                       if (obj->refcount == 0) {
-                               munmap(obj->mapbase, obj->mapsize);
-                               free(obj->path);
-                               while (obj->needed != NULL) {
-                                       Needed_Entry   *needed = obj->needed;
-                                       obj->needed = needed->next;
-                                       free(needed);
-                               }
-                               _rtld_linkmap_delete(obj);
-                               *linkp = obj->next;
-                               if (obj->next == NULL)
-                                       _rtld_objtail = linkp;
-                               free(obj);
-                       } else
-                               linkp = &obj->next;
-               }
-       }
        _rtld_debug.r_state = RT_CONSISTENT;
        _rtld_debug_state();
 



Home | Main Index | Thread Index | Old Index