diff options
-rw-r--r-- | libexec/ld.so/dlfcn.c | 4 | ||||
-rw-r--r-- | libexec/ld.so/library.c | 4 | ||||
-rw-r--r-- | libexec/ld.so/library_mquery.c | 4 | ||||
-rw-r--r-- | libexec/ld.so/library_subr.c | 4 | ||||
-rw-r--r-- | libexec/ld.so/loader.c | 8 | ||||
-rw-r--r-- | libexec/ld.so/resolve.c | 4 | ||||
-rw-r--r-- | libexec/ld.so/resolve.h | 6 |
7 files changed, 18 insertions, 16 deletions
diff --git a/libexec/ld.so/dlfcn.c b/libexec/ld.so/dlfcn.c index 03fbfda44f2..e363e9a7d44 100644 --- a/libexec/ld.so/dlfcn.c +++ b/libexec/ld.so/dlfcn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dlfcn.c,v 1.65 2005/10/07 01:26:33 kurt Exp $ */ +/* $OpenBSD: dlfcn.c,v 1.66 2005/10/09 04:29:13 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 + object->opencount + object->grprefcount > 1) + if (OBJECT_REF_CNT(object) > 1) goto loaded; /* this add_object should not be here, XXX */ diff --git a/libexec/ld.so/library.c b/libexec/ld.so/library.c index 5e7bd7fdfd2..753f0b53617 100644 --- a/libexec/ld.so/library.c +++ b/libexec/ld.so/library.c @@ -1,4 +1,4 @@ -/* $OpenBSD: library.c,v 1.48 2005/10/06 21:53:10 kurt Exp $ */ +/* $OpenBSD: library.c,v 1.49 2005/10/09 04:29:13 kurt Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -59,7 +59,7 @@ _dl_unload_shlib(elf_object_t *object) { struct dep_node *n; DL_DEB(("unload_shlib called on %s\n", object->load_name)); - if (object->refcount + object->opencount + object->grprefcount == 0 && + if (OBJECT_REF_CNT(object) == 0 && (object->status & STAT_UNLOADED) == 0) { object->status |= STAT_UNLOADED; TAILQ_FOREACH(n, &object->child_list, next_sib) diff --git a/libexec/ld.so/library_mquery.c b/libexec/ld.so/library_mquery.c index a77ba47091c..b6bf72cf5de 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.29 2005/10/06 21:53:10 kurt Exp $ */ +/* $OpenBSD: library_mquery.c,v 1.30 2005/10/09 04:29:13 kurt Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -64,7 +64,7 @@ _dl_unload_shlib(elf_object_t *object) { struct dep_node *n; DL_DEB(("unload_shlib called on %s\n", object->load_name)); - if (object->refcount + object->opencount + object->grprefcount == 0 && + if (OBJECT_REF_CNT(object) == 0 && (object->status & STAT_UNLOADED) == 0) { object->status |= STAT_UNLOADED; TAILQ_FOREACH(n, &object->child_list, next_sib) diff --git a/libexec/ld.so/library_subr.c b/libexec/ld.so/library_subr.c index 0cbb3b8e92c..4d553d67b65 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.18 2005/10/07 01:26:34 kurt Exp $ */ +/* $OpenBSD: library_subr.c,v 1.19 2005/10/09 04:29:13 kurt Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -356,7 +356,7 @@ _dl_notify_unload_shlib(elf_object_t *object) { struct dep_node *n; - if (object->opencount + object->grprefcount == 0) { + if (OBJECT_DLREF_CNT(object) == 0) { TAILQ_FOREACH(n, &object->grpsym_list, next_sib) { if (n->data == object) continue; diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c index 55cd0ea74ea..37c90362b6a 100644 --- a/libexec/ld.so/loader.c +++ b/libexec/ld.so/loader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: loader.c,v 1.94 2005/10/07 01:26:34 kurt Exp $ */ +/* $OpenBSD: loader.c,v 1.95 2005/10/09 04:29:13 kurt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -96,8 +96,7 @@ _dl_run_all_dtors() node != NULL; node = node->next) { if ((node->dyn.fini) && - (node->refcount + node->opencount + - node->grprefcount == 0) && + (OBJECT_REF_CNT(node) == 0) && (node->status & STAT_INIT_DONE) && ((node->status & STAT_FINI_DONE) == 0)) { node->status |= STAT_FINI_READY; @@ -107,8 +106,7 @@ _dl_run_all_dtors() node != NULL; node = node->next ) { if ((node->dyn.fini) && - (node->refcount + node->opencount + - node->grprefcount == 0) && + (OBJECT_REF_CNT(node) == 0) && (node->status & STAT_INIT_DONE) && ((node->status & STAT_FINI_DONE) == 0)) TAILQ_FOREACH(dnode, &node->child_list, diff --git a/libexec/ld.so/resolve.c b/libexec/ld.so/resolve.c index 8c4511b95c4..b76df7997fa 100644 --- a/libexec/ld.so/resolve.c +++ b/libexec/ld.so/resolve.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resolve.c,v 1.41 2005/10/07 01:26:34 kurt Exp $ */ +/* $OpenBSD: resolve.c,v 1.42 2005/10/09 04:29:13 kurt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -191,7 +191,7 @@ _dl_cleanup_objects() n = TAILQ_FIRST(&_dlopened_child_list); while (n != NULL) { next = TAILQ_NEXT(n, next_sib); - if (n->data->opencount + n->data->grprefcount == 0) { + if (OBJECT_DLREF_CNT(n->data) == 0) { TAILQ_REMOVE(&_dlopened_child_list, n, next_sib); _dl_free(n); } diff --git a/libexec/ld.so/resolve.h b/libexec/ld.so/resolve.h index b7e734a4906..173603ce38d 100644 --- a/libexec/ld.so/resolve.h +++ b/libexec/ld.so/resolve.h @@ -1,4 +1,4 @@ -/* $OpenBSD: resolve.h,v 1.46 2005/10/07 01:26:34 kurt Exp $ */ +/* $OpenBSD: resolve.h,v 1.47 2005/10/09 04:29:13 kurt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -129,6 +129,10 @@ struct elf_object { int refcount; /* dep libs only */ int opencount; /* # dlopen() & exe */ int grprefcount; /* load group refs */ +#define OBJECT_REF_CNT(object) \ + ((object->refcount + object->opencount + object->grprefcount)) +#define OBJECT_DLREF_CNT(object) \ + ((object->opencount + object->grprefcount)) /* object that caused this module to be loaded, used in symbol lookup */ elf_object_t *load_object; |