diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-08-08 07:43:03 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-08-08 07:43:03 +0000 |
commit | 334fcf2a65f3b58867ce136da767c6c58a3d45ed (patch) | |
tree | 36daebcd9bc1c447dc5bd04ac0e1b310214fa8e6 /linuxthreads | |
parent | a30fb2df74710413014897f527bb565caf7cab9f (diff) | |
download | glibc-334fcf2a65f3b58867ce136da767c6c58a3d45ed.tar.gz glibc-334fcf2a65f3b58867ce136da767c6c58a3d45ed.tar.xz glibc-334fcf2a65f3b58867ce136da767c6c58a3d45ed.zip |
Update.
2003-08-07 Jakub Jelinek <jakub@redhat.com> * sysdeps/generic/ldsodefs.h (_rtld_global): Add _dl_rtld_lock_recursive and _dl_rtld_unlock_recursive. * elf/rtld.c (rtld_lock_default_lock_recursive, rtld_lock_default_unlock_recursive): New functions. (dl_main): Initialize _dl_rtld_lock_recursive and _dl_rtld_unlock_recursive. 2003-08-05 Jakub Jelinek <jakub@redhat.com> * elf/ldconfig.c (main): Append SLIBDIR and LIBDIR to config_file directories instead of prepending.
Diffstat (limited to 'linuxthreads')
-rw-r--r-- | linuxthreads/ChangeLog | 13 | ||||
-rw-r--r-- | linuxthreads/pthread.c | 9 | ||||
-rw-r--r-- | linuxthreads/sysdeps/pthread/bits/libc-lock.h | 18 |
3 files changed, 38 insertions, 2 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index 89568cd702..54d7e425ac 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,16 @@ +2003-08-07 Jakub Jelinek <jakub@redhat.com> + + * sysdeps/pthread/bits/libc-lock.h [_LIBC && SHARED] + (__rtld_lock_default_lock_recursive, + __rtld_lock_default_unlock_recursive): Define. + [_LIBC && SHARED] (__rtld_lock_lock_recursive, + __rtld_lock_unlock_recursive): Define using + GL(_dl_rtld_*lock_recursive). + * pthread.c (pthread_initialize): Initialize _dl_rtld_lock_recursive + and _dl_rtld_unlock_recursive. Lock GL(_dl_load_lock) the same + number of times as GL(_dl_load_lock) using non-mt implementation was + nested. + 2003-07-31 Jakub Jelinek <jakub@redhat.com> * sysdeps/pthread/bits/typesizes.h (__SSIZE_T_TYPE): Define. diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c index f7081139b2..f261f8e8f4 100644 --- a/linuxthreads/pthread.c +++ b/linuxthreads/pthread.c @@ -588,6 +588,15 @@ static void pthread_initialize(void) /* Transfer the old value from the dynamic linker's internal location. */ *__libc_dl_error_tsd () = *(*GL(dl_error_catch_tsd)) (); GL(dl_error_catch_tsd) = &__libc_dl_error_tsd; + + /* Make __rtld_lock_{,un}lock_recursive use pthread_mutex_{,un}lock, + keep the lock count from the ld.so implementation. */ + GL(dl_rtld_lock_recursive) = (void *) __pthread_mutex_lock; + GL(dl_rtld_unlock_recursive) = (void *) __pthread_mutex_unlock; + unsigned int rtld_lock_count = GL(dl_load_lock).mutex.__m_count; + GL(dl_load_lock).mutex.__m_count = 0; + while (rtld_lock_count-- > 0) + __pthread_mutex_lock (&GL(dl_load_lock).mutex); #endif #ifdef USE_TLS diff --git a/linuxthreads/sysdeps/pthread/bits/libc-lock.h b/linuxthreads/sysdeps/pthread/bits/libc-lock.h index 2697a18371..c0d0debe14 100644 --- a/linuxthreads/sysdeps/pthread/bits/libc-lock.h +++ b/linuxthreads/sysdeps/pthread/bits/libc-lock.h @@ -180,7 +180,6 @@ typedef pthread_key_t __libc_key_t; /* Lock the recursive named lock variable. */ #define __libc_lock_lock_recursive(NAME) __libc_lock_lock ((NAME).mutex) -#define __rtld_lock_lock_recursive(NAME) __libc_lock_lock_recursive (NAME) /* Try to lock the named lock variable. */ #define __libc_lock_trylock(NAME) \ @@ -203,8 +202,23 @@ typedef pthread_key_t __libc_key_t; /* Unlock the recursive named lock variable. */ #define __libc_lock_unlock_recursive(NAME) __libc_lock_unlock ((NAME).mutex) -#define __rtld_lock_unlock_recursive(NAME) __libc_lock_unlock_recursive (NAME) +#if defined _LIBC && defined SHARED +# define __rtld_lock_default_lock_recursive(lock) \ + ++((pthread_mutex_t *)(lock))->__m_count; + +# define __rtld_lock_default_unlock_recursive(lock) \ + --((pthread_mutex_t *)(lock))->__m_count; + +# define __rtld_lock_lock_recursive(NAME) \ + GL(dl_rtld_lock_recursive) (&(NAME).mutex) + +# define __rtld_lock_unlock_recursive(NAME) \ + GL(dl_rtld_unlock_recursive) (&(NAME).mutex) +#else +#define __rtld_lock_lock_recursive(NAME) __libc_lock_lock_recursive (NAME) +#define __rtld_lock_unlock_recursive(NAME) __libc_lock_unlock_recursive (NAME) +#endif /* Define once control variable. */ #if PTHREAD_ONCE_INIT == 0 |