summaryrefslogtreecommitdiff
path: root/libexec/ld.so/dlfcn.c
diff options
context:
space:
mode:
authorKurt Miller <kurt@cvs.openbsd.org>2005-10-06 21:53:11 +0000
committerKurt Miller <kurt@cvs.openbsd.org>2005-10-06 21:53:11 +0000
commit99b23dec2e6d2eac00cc9925a0a2615931b47b08 (patch)
tree91de14214f7f9c11ad47810d58e963df431443f8 /libexec/ld.so/dlfcn.c
parent28cbdbfb1a2959f448b47d2c463127d6891fe5fd (diff)
separate load group references from dep lib child/dload lists. move load
group refs to own per object ref counter (grprefcount) and list (grpref_list). corrects more complex load group ref cases and side effects from initial implementation. design ideas and ok drahn@
Diffstat (limited to 'libexec/ld.so/dlfcn.c')
-rw-r--r--libexec/ld.so/dlfcn.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libexec/ld.so/dlfcn.c b/libexec/ld.so/dlfcn.c
index 3027141f6f6..e7fe6983286 100644
--- a/libexec/ld.so/dlfcn.c
+++ b/libexec/ld.so/dlfcn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dlfcn.c,v 1.62 2005/10/05 21:50:53 kurt Exp $ */
+/* $OpenBSD: dlfcn.c,v 1.63 2005/10/06 21:53:09 kurt Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -71,7 +71,7 @@ dlopen(const char *libname, int flags)
_dl_link_dlopen(object);
- if (++object->refcount > 1)
+ if (object->refcount + object->opencount + object->grprefcount > 1)
goto loaded;
/* this add_object should not be here, XXX */
@@ -288,9 +288,9 @@ _dl_real_close(void *handle)
return (1);
}
+ object->opencount--;
_dl_notify_unload_shlib(object);
_dl_run_all_dtors();
- object->opencount--;
_dl_unload_shlib(object);
_dl_cleanup_objects();
return (0);
@@ -368,7 +368,7 @@ _dl_show_objects(void)
pad = " ";
else
pad = "";
- _dl_fdprintf(outputfd, "\tStart %s End %s Type Ref Name\n",
+ _dl_fdprintf(outputfd, "\tStart %s End %s Type Open Ref GrpRef Name\n",
pad, pad);
while (object) {
@@ -389,10 +389,11 @@ _dl_show_objects(void)
objtypename = "????";
break;
}
- _dl_fdprintf(outputfd, "\t%lX %lX %s %d %s\n",
+ _dl_fdprintf(outputfd, "\t%lX %lX %s %d %d %d %s\n",
(void *)object->load_addr,
(void *)(object->load_addr + object->load_size),
- objtypename, object->refcount, object->load_name);
+ objtypename, object->opencount, object->refcount,
+ object->grprefcount, object->load_name);
object = object->next;
}