diff options
author | Roland McGrath <roland@gnu.org> | 2001-08-23 06:03:42 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2001-08-23 06:03:42 +0000 |
commit | c12aa8015699d66a193c3c183b4f1d1a72bb92c1 (patch) | |
tree | a20c1864b74c8471aa7aaf675da180546b16c537 /sysdeps/generic | |
parent | 8179dcc10808cf2a515cf19d445789193a763ec4 (diff) | |
download | glibc-c12aa8015699d66a193c3c183b4f1d1a72bb92c1.tar.gz glibc-c12aa8015699d66a193c3c183b4f1d1a72bb92c1.tar.xz glibc-c12aa8015699d66a193c3c183b4f1d1a72bb92c1.zip |
* 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 'sysdeps/generic')
-rw-r--r-- | sysdeps/generic/bits/libc-lock.h | 3 | ||||
-rw-r--r-- | sysdeps/generic/bits/stdio-lock.h | 15 | ||||
-rw-r--r-- | sysdeps/generic/ldsodefs.h | 11 |
3 files changed, 19 insertions, 10 deletions
diff --git a/sysdeps/generic/bits/libc-lock.h b/sysdeps/generic/bits/libc-lock.h index ec95e81fe8..ca90d35c95 100644 --- a/sysdeps/generic/bits/libc-lock.h +++ b/sysdeps/generic/bits/libc-lock.h @@ -1,5 +1,5 @@ /* libc-internal interface for mutex locks. Stub version. - Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1996,97,99,2000,01 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,6 +29,7 @@ begins with a `*'), because its storage size will not be known outside of libc. */ #define __libc_lock_define(CLASS,NAME) +#define __libc_lock_define_recursive(CLASS,NAME) #define __libc_rwlock_define(CLASS,NAME) /* Define an initialized lock variable NAME with storage class CLASS. */ diff --git a/sysdeps/generic/bits/stdio-lock.h b/sysdeps/generic/bits/stdio-lock.h index 225ccd8ff7..f7c61088f1 100644 --- a/sysdeps/generic/bits/stdio-lock.h +++ b/sysdeps/generic/bits/stdio-lock.h @@ -22,12 +22,17 @@ #include <bits/libc-lock.h> -__libc_lock_define (typedef, _IO_lock_t) +__libc_lock_define_recursive (typedef, _IO_lock_t) /* We need recursive (counting) mutexes. */ #define _IO_lock_initializer ... #error libio needs recursive mutexes for _IO_MTSAFE_IO +#define _IO_lock_init(_name) __libc_lock_init_recursive (_name) +#define _IO_lock_fini(_name) __libc_lock_fini_recursive (_name) +#define _IO_lock_lock(_name) __libc_lock_lock_recursive (_name) +#define _IO_lock_unlock(_name) __libc_lock_unlock_recursive (_name) + #define _IO_cleanup_region_start(_fct, _fp) \ __libc_cleanup_region_start (_fct, _fp) @@ -35,14 +40,6 @@ __libc_lock_define (typedef, _IO_lock_t) __libc_cleanup_region_start (_fct, NULL) #define _IO_cleanup_region_end(_doit) \ __libc_cleanup_region_end (_doit) -#define _IO_lock_init(_name) \ - __libc_lock_init_recursive (_name) -#define _IO_lock_fini(_name) \ - __libc_lock_fini_recursive (_name) -#define _IO_lock_lock(_name) \ - __libc_lock_lock (_name) -#define _IO_lock_unlock(_name) \ - __libc_lock_unlock (_name) #endif /* bits/stdio-lock.h */ diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index a98b01a6a7..6d196c7379 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -31,6 +31,7 @@ #include <dlfcn.h> #include <link.h> #include <dl-lookupcfg.h> +#include <bits/libc-lock.h> __BEGIN_DECLS @@ -229,6 +230,16 @@ extern struct r_search_path_elem *_dl_init_all_dirs; extern int _dl_sysdep_open_zero_fill (void); /* dl-sysdep.c */ +/* 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_recursive (extern, _dl_load_lock) + + /* Write message on the debug file descriptor. The parameters are interpreted as for a `printf' call. All the lines start with a tag showing the PID. */ |