diff options
author | Florian Weimer <fweimer@redhat.com> | 2021-04-21 19:49:51 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2021-04-21 19:49:51 +0200 |
commit | 27a448223cb2d3bab191c61303db48cee66f871c (patch) | |
tree | e9cb7ab65f5efb5d486c79ee58b4ccadfbe7896c /sysdeps/nptl/libc-lockP.h | |
parent | 60d5e40ab200033a982a9fd7594a1f83dcdb94a0 (diff) | |
download | glibc-27a448223cb2d3bab191c61303db48cee66f871c.zip glibc-27a448223cb2d3bab191c61303db48cee66f871c.tar.gz glibc-27a448223cb2d3bab191c61303db48cee66f871c.tar.bz2 |
nptl: Move core mutex functions into libc
This is complicated because of a second compilation of
nptl/pthread_mutex_lock.c via nptl/pthread_mutex_cond_lock.c.
PTHREAD_MUTEX_VERSIONS is introduced to suppress symbol versions
in that case.
The symbols __pthread_mutex_lock, __pthread_mutex_unlock,
__pthread_mutex_init, __pthread_mutex_destroy, pthread_mutex_lock,
pthread_mutex_unlock, pthread_mutex_init, pthread_mutex_destroy
have been moved using scripts/move-symbol-to-libc.py.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/nptl/libc-lockP.h')
-rw-r--r-- | sysdeps/nptl/libc-lockP.h | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/sysdeps/nptl/libc-lockP.h b/sysdeps/nptl/libc-lockP.h index 8991056..0dd2ea1 100644 --- a/sysdeps/nptl/libc-lockP.h +++ b/sysdeps/nptl/libc-lockP.h @@ -128,8 +128,7 @@ _Static_assert (LLL_LOCK_INITIALIZER == 0, "LLL_LOCK_INITIALIZER != 0"); # define __libc_lock_init(NAME) \ ((void) ((NAME) = LLL_LOCK_INITIALIZER)) #else -# define __libc_lock_init(NAME) \ - __libc_maybe_call (__pthread_mutex_init, (&(NAME), NULL), 0) +# define __libc_lock_init(NAME) __pthread_mutex_init (&(NAME)) #endif #if defined SHARED && IS_IN (libc) /* ((NAME) = (__libc_rwlock_t) PTHREAD_RWLOCK_INITIALIZER) is inefficient. */ @@ -146,8 +145,7 @@ _Static_assert (LLL_LOCK_INITIALIZER == 0, "LLL_LOCK_INITIALIZER != 0"); #if IS_IN (libc) || IS_IN (libpthread) # define __libc_lock_fini(NAME) ((void) 0) #else -# define __libc_lock_fini(NAME) \ - __libc_maybe_call (__pthread_mutex_destroy, (&(NAME)), 0) +# define __libc_lock_fini(NAME) __pthread_mutex_destroy (&(NAME)) #endif #if defined SHARED && IS_IN (libc) # define __libc_rwlock_fini(NAME) ((void) 0) @@ -164,8 +162,7 @@ _Static_assert (LLL_LOCK_INITIALIZER == 0, "LLL_LOCK_INITIALIZER != 0"); # endif #else # undef __libc_lock_lock -# define __libc_lock_lock(NAME) \ - __libc_maybe_call (__pthread_mutex_lock, (&(NAME)), 0) +# define __libc_lock_lock(NAME) __pthread_mutex_lock (&(NAME)) #endif #define __libc_rwlock_rdlock(NAME) __pthread_rwlock_rdlock (&(NAME)) #define __libc_rwlock_wrlock(NAME) __pthread_rwlock_wrlock (&(NAME)) @@ -194,8 +191,7 @@ _Static_assert (LLL_LOCK_INITIALIZER == 0, "LLL_LOCK_INITIALIZER != 0"); # define __libc_lock_unlock(NAME) \ lll_unlock (NAME, LLL_PRIVATE) #else -# define __libc_lock_unlock(NAME) \ - __libc_maybe_call (__pthread_mutex_unlock, (&(NAME)), 0) +# define __libc_lock_unlock(NAME) __pthread_mutex_unlock (&(NAME)) #endif #define __libc_rwlock_unlock(NAME) __pthread_rwlock_unlock (&(NAME)) @@ -213,10 +209,10 @@ _Static_assert (LLL_LOCK_INITIALIZER == 0, "LLL_LOCK_INITIALIZER != 0"); GL(dl_rtld_unlock_recursive) (&(NAME).mutex) #else # define __rtld_lock_lock_recursive(NAME) \ - __libc_maybe_call (__pthread_mutex_lock, (&(NAME).mutex), 0) + __pthread_mutex_lock (&(NAME).mutex) # define __rtld_lock_unlock_recursive(NAME) \ - __libc_maybe_call (__pthread_mutex_unlock, (&(NAME).mutex), 0) + __pthread_mutex_unlock (&(NAME).mutex) #endif /* Define once control variable. */ @@ -274,15 +270,15 @@ extern int __register_atfork (void (*__prepare) (void), extern int __pthread_mutex_init (pthread_mutex_t *__mutex, const pthread_mutexattr_t *__mutex_attr); - +libc_hidden_proto (__pthread_mutex_init) extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex); - +libc_hidden_proto (__pthread_mutex_destroy) extern int __pthread_mutex_trylock (pthread_mutex_t *__mutex); extern int __pthread_mutex_lock (pthread_mutex_t *__mutex); - +libc_hidden_proto (__pthread_mutex_lock) extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex); - +libc_hidden_proto (__pthread_mutex_unlock) extern int __pthread_mutexattr_init (pthread_mutexattr_t *__attr); extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *__attr); @@ -320,11 +316,7 @@ libc_hidden_proto (__pthread_setcancelstate) single-threaded processes. */ #ifndef __NO_WEAK_PTHREAD_ALIASES # ifdef weak_extern -weak_extern (__pthread_mutex_init) -weak_extern (__pthread_mutex_destroy) -weak_extern (__pthread_mutex_lock) weak_extern (__pthread_mutex_trylock) -weak_extern (__pthread_mutex_unlock) weak_extern (__pthread_mutexattr_init) weak_extern (__pthread_mutexattr_destroy) weak_extern (__pthread_mutexattr_settype) @@ -335,11 +327,7 @@ weak_extern (__pthread_rwlock_trywrlock) weak_extern (__pthread_initialize) weak_extern (__pthread_atfork) # else -# pragma weak __pthread_mutex_init -# pragma weak __pthread_mutex_destroy -# pragma weak __pthread_mutex_lock # pragma weak __pthread_mutex_trylock -# pragma weak __pthread_mutex_unlock # pragma weak __pthread_mutexattr_init # pragma weak __pthread_mutexattr_destroy # pragma weak __pthread_mutexattr_settype |