aboutsummaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2001-08-23 06:03:42 +0000
committerRoland McGrath <roland@gnu.org>2001-08-23 06:03:42 +0000
commitc12aa8015699d66a193c3c183b4f1d1a72bb92c1 (patch)
treea20c1864b74c8471aa7aaf675da180546b16c537 /elf
parent8179dcc10808cf2a515cf19d445789193a763ec4 (diff)
downloadglibc-c12aa8015699d66a193c3c183b4f1d1a72bb92c1.zip
glibc-c12aa8015699d66a193c3c183b4f1d1a72bb92c1.tar.gz
glibc-c12aa8015699d66a193c3c183b4f1d1a72bb92c1.tar.bz2
* sysdeps/generic/ldsodefs.h (_dl_load_lock): Declare it here with
__libc_lock_define_recursive. * elf/dl-open.c: Don't declare it here any more. * elf/dl-close.c: Likewise. * elf/dl-lookup.c: Likewise. * elf/dl-iteratephdr.c: Likewise. * elf/dl-lookup.c (add_dependency): Use __libc_lock_lock_recursive and __libc_lock_unlock_recursive. * elf/dl-close.c (_dl_close): Likewise * elf/dl-iteratephdr.c (__dl_iterate_phdr): Likewise * elf/dl-open.c (_dl_open): Likewise * sysdeps/generic/bits/libc-lock.h (__libc_lock_define_recursive): New macro. * sysdeps/generic/bits/stdio-lock.h (_IO_lock_t): Use it. (_IO_lock_lock): Use __libc_lock_lock_recursive. (_IO_lock_unlock): Use __libc_lock_unlock_recursive.
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-close.c11
-rw-r--r--elf/dl-iteratephdr.c6
-rw-r--r--elf/dl-lookup.c13
-rw-r--r--elf/dl-open.c13
4 files changed, 9 insertions, 34 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 3d24892..66c88b2 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -32,11 +32,6 @@
typedef void (*fini_t) (void);
-/* During the program run we must not modify the global data of
- loaded shared object simultanously in two threads. Therefore we
- protect `dlopen' and `dlclose' in dlclose.c. */
-__libc_lock_define (extern, _dl_load_lock)
-
void
internal_function
_dl_close (void *_map)
@@ -61,7 +56,7 @@ _dl_close (void *_map)
_dl_signal_error (0, map->l_name, N_("shared object not open"));
/* Acquire the lock. */
- __libc_lock_lock (_dl_load_lock);
+ __libc_lock_lock_recursive (_dl_load_lock);
/* Decrement the reference count. */
if (map->l_opencount > 1 || map->l_type != lt_loaded)
@@ -80,7 +75,7 @@ _dl_close (void *_map)
/* One decrement the object itself, not the dependencies. */
--map->l_opencount;
- __libc_lock_unlock (_dl_load_lock);
+ __libc_lock_unlock_recursive (_dl_load_lock);
return;
}
@@ -277,7 +272,7 @@ _dl_close (void *_map)
free (list);
/* Release the lock. */
- __libc_lock_unlock (_dl_load_lock);
+ __libc_lock_unlock_recursive (_dl_load_lock);
}
diff --git a/elf/dl-iteratephdr.c b/elf/dl-iteratephdr.c
index fa62dc7..ff11ce5 100644
--- a/elf/dl-iteratephdr.c
+++ b/elf/dl-iteratephdr.c
@@ -23,8 +23,6 @@
#include <stddef.h>
#include <bits/libc-lock.h>
-__libc_lock_define (extern, _dl_load_lock)
-
int
__dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
size_t size, void *data), void *data)
@@ -34,7 +32,7 @@ __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
int ret = 0;
/* Make sure we are alone. */
- __libc_lock_lock (_dl_load_lock);
+ __libc_lock_lock_recursive (_dl_load_lock);
for (l = _dl_loaded; l != NULL; l = l->l_next)
{
@@ -51,7 +49,7 @@ __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
}
/* Release the lock. */
- __libc_lock_unlock (_dl_load_lock);
+ __libc_lock_unlock_recursive (_dl_load_lock);
return ret;
}
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 85b9718..fe833ba 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -61,15 +61,6 @@ struct sym_val
/* Statistics function. */
unsigned long int _dl_num_relocations;
-/* During the program run we must not modify the global data of
- loaded shared object simultanously in two threads. Therefore we
- protect `_dl_open' and `_dl_close' in dl-close.c.
-
- This must be a recursive lock since the initializer function of
- the loaded object might as well require a call to this function.
- At this time it is not anymore a problem to modify the tables. */
-__libc_lock_define (extern, _dl_load_lock)
-
/* We have two different situations when looking up a simple: with or
without versioning. gcc is not able to optimize a single function
@@ -92,7 +83,7 @@ add_dependency (struct link_map *undef_map, struct link_map *map)
int result = 0;
/* Make sure nobody can unload the object while we are at it. */
- __libc_lock_lock (_dl_load_lock);
+ __libc_lock_lock_recursive (_dl_load_lock);
/* Determine whether UNDEF_MAP already has a reference to MAP. First
look in the normal dependencies. */
@@ -174,7 +165,7 @@ add_dependency (struct link_map *undef_map, struct link_map *map)
}
/* Release the lock. */
- __libc_lock_unlock (_dl_load_lock);
+ __libc_lock_unlock_recursive (_dl_load_lock);
return result;
}
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 2f4c97b..9d21a50 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -58,15 +58,6 @@ extern int _dl_lazy; /* Do we do lazy relocations? */
static void show_scope (struct link_map *new);
#endif
-/* During the program run we must not modify the global data of
- loaded shared object simultanously in two threads. Therefore we
- protect `_dl_open' and `_dl_close' in dl-close.c.
-
- This must be a recursive lock since the initializer function of
- the loaded object might as well require a call to this function.
- At this time it is not anymore a problem to modify the tables. */
-__libc_lock_define (extern, _dl_load_lock)
-
extern size_t _dl_platformlen;
/* We must be carefull not to leave us in an inconsistent state. Thus we
@@ -349,7 +340,7 @@ _dl_open (const char *file, int mode, const void *caller)
_dl_signal_error (EINVAL, file, N_("invalid mode for dlopen()"));
/* Make sure we are alone. */
- __libc_lock_lock (_dl_load_lock);
+ __libc_lock_lock_recursive (_dl_load_lock);
args.file = file;
args.mode = mode;
@@ -363,7 +354,7 @@ _dl_open (const char *file, int mode, const void *caller)
#endif
/* Release the lock. */
- __libc_lock_unlock (_dl_load_lock);
+ __libc_lock_unlock_recursive (_dl_load_lock);
if (errstring)
{