From a2b0f2e1864f03084138a105e1d5f2cf86a62425 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Fri, 23 Apr 2021 09:44:23 +0200 Subject: nptl: Move pthread_mutex_trylock, __pthread_mutex_trylock into libc The symbols were moved using scripts/move-symbol-to-libc.py. __pthread_mutex_trylock is used to implement mtx_timedlock, which still resides in libpthread, so add a GLIBC_2.34 version for it, to match the existing GLIBC_2.0 version. --- nptl/Makefile | 2 +- nptl/Versions | 4 ++-- nptl/pthreadP.h | 2 +- nptl/pthread_mutex_trylock.c | 18 +++++++++++------- 4 files changed, 15 insertions(+), 11 deletions(-) (limited to 'nptl') diff --git a/nptl/Makefile b/nptl/Makefile index 31d05b36e3..8e015157f5 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -101,6 +101,7 @@ routines = \ pthread_mutex_lock \ pthread_mutex_setprioceiling \ pthread_mutex_timedlock \ + pthread_mutex_trylock \ pthread_mutex_unlock \ pthread_once \ pthread_rwlock_rdlock \ @@ -161,7 +162,6 @@ libpthread-routines = \ pthread_getname \ pthread_join \ pthread_join_common \ - pthread_mutex_trylock \ pthread_mutexattr_destroy \ pthread_mutexattr_getprioceiling \ pthread_mutexattr_getprotocol \ diff --git a/nptl/Versions b/nptl/Versions index ddf3bbb1cd..ab79ae2b21 100644 --- a/nptl/Versions +++ b/nptl/Versions @@ -5,6 +5,7 @@ libc { __pthread_mutex_destroy; __pthread_mutex_init; __pthread_mutex_lock; + __pthread_mutex_trylock; __pthread_mutex_unlock; __pthread_once; __pthread_setspecific; @@ -44,6 +45,7 @@ libc { pthread_mutex_destroy; pthread_mutex_init; pthread_mutex_lock; + pthread_mutex_trylock; pthread_mutex_unlock; pthread_once; pthread_self; @@ -195,7 +197,6 @@ libpthread { _IO_funlockfile; __errno_location; __h_errno_location; - __pthread_mutex_trylock; __pthread_mutexattr_destroy; __pthread_mutexattr_init; __pthread_mutexattr_settype; @@ -207,7 +208,6 @@ libpthread { pthread_create; pthread_detach; pthread_join; - pthread_mutex_trylock; pthread_mutexattr_destroy; pthread_mutexattr_getkind_np; pthread_mutexattr_init; diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h index 0def617109..8432c0ebe7 100644 --- a/nptl/pthreadP.h +++ b/nptl/pthreadP.h @@ -396,6 +396,7 @@ 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); +libc_hidden_proto (__pthread_mutex_trylock) extern int __pthread_mutex_lock (pthread_mutex_t *__mutex); libc_hidden_proto (__pthread_mutex_lock) extern int __pthread_mutex_timedlock (pthread_mutex_t *__mutex, @@ -576,7 +577,6 @@ libc_hidden_proto (__pthread_sigmask); #if IS_IN (libpthread) -hidden_proto (__pthread_mutex_trylock) hidden_proto (__pthread_rwlock_unlock) hidden_proto (__pthread_testcancel) hidden_proto (__pthread_mutexattr_init) diff --git a/nptl/pthread_mutex_trylock.c b/nptl/pthread_mutex_trylock.c index e52dddafbd..623ea75db0 100644 --- a/nptl/pthread_mutex_trylock.c +++ b/nptl/pthread_mutex_trylock.c @@ -24,7 +24,7 @@ #include int -__pthread_mutex_trylock (pthread_mutex_t *mutex) +___pthread_mutex_trylock (pthread_mutex_t *mutex) { int oldval; pid_t id = THREAD_GETMEM (THREAD_SELF, tid); @@ -449,10 +449,14 @@ __pthread_mutex_trylock (pthread_mutex_t *mutex) return EBUSY; } - -#ifndef __pthread_mutex_trylock -#ifndef pthread_mutex_trylock -weak_alias (__pthread_mutex_trylock, pthread_mutex_trylock) -hidden_def (__pthread_mutex_trylock) -#endif +libc_hidden_ver (___pthread_mutex_trylock, __pthread_mutex_trylock) +versioned_symbol (libc, ___pthread_mutex_trylock, + pthread_mutex_trylock, GLIBC_2_34); +versioned_symbol (libc, ___pthread_mutex_trylock, + __pthread_mutex_trylock, GLIBC_2_34); +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_34) +compat_symbol (libpthread, ___pthread_mutex_trylock, + pthread_mutex_trylock, GLIBC_2_0); +compat_symbol (libpthread, ___pthread_mutex_trylock, + __pthread_mutex_trylock, GLIBC_2_0); #endif -- cgit v1.2.3