about summary refs log tree commit diff
path: root/sysdeps/pthread
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-05-03 08:12:11 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-05-03 08:15:58 +0200
commit08970190fc225b319ba456f621a62a50858fa0f6 (patch)
treed926adc67470162c0b933270987f08c37b1ff7fd /sysdeps/pthread
parent032a9e17a7201765228262b9b6731839dcfdf885 (diff)
downloadglibc-08970190fc225b319ba456f621a62a50858fa0f6.tar.gz
glibc-08970190fc225b319ba456f621a62a50858fa0f6.tar.xz
glibc-08970190fc225b319ba456f621a62a50858fa0f6.zip
nptl: Move mtx_trylock into libc
The symbol was moved using scripts/move-symbol-to-libc.py.

The __pthread_mutex_trylock@@GLIBC_2.34 symbol version is no longer
needed because the call is now internal to libc, so remove it with
this commit.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'sysdeps/pthread')
-rw-r--r--sysdeps/pthread/Makefile3
-rw-r--r--sysdeps/pthread/mtx_trylock.c11
2 files changed, 12 insertions, 2 deletions
diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
index 73ee8abdca..dbff46dd45 100644
--- a/sysdeps/pthread/Makefile
+++ b/sysdeps/pthread/Makefile
@@ -32,7 +32,7 @@ headers += threads.h
 routines += thrd_current thrd_equal thrd_sleep thrd_yield
 
 libpthread-routines += thrd_create thrd_detach thrd_exit thrd_join \
-		       mtx_trylock mtx_unlock \
+		       mtx_unlock \
 		       tss_create tss_delete tss_get tss_set
 
 $(libpthread-routines-var) += \
@@ -47,6 +47,7 @@ $(libpthread-routines-var) += \
   mtx_init \
   mtx_lock \
   mtx_timedlock \
+  mtx_trylock \
 
 tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
 	 tst-cnd-timedwait tst-thrd-detach tst-mtx-basic tst-thrd-sleep \
diff --git a/sysdeps/pthread/mtx_trylock.c b/sysdeps/pthread/mtx_trylock.c
index 0656e98eeb..598701b1e8 100644
--- a/sysdeps/pthread/mtx_trylock.c
+++ b/sysdeps/pthread/mtx_trylock.c
@@ -16,11 +16,20 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+#include <shlib-compat.h>
 #include "thrd_priv.h"
 
 int
-mtx_trylock (mtx_t *mutex)
+__mtx_trylock (mtx_t *mutex)
 {
   int err_code = __pthread_mutex_trylock ((pthread_mutex_t *) mutex);
   return thrd_err_map (err_code);
 }
+#if PTHREAD_IN_LIBC
+versioned_symbol (libc, __mtx_trylock, mtx_trylock, GLIBC_2_34);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_28, GLIBC_2_34)
+compat_symbol (libpthread, __mtx_trylock, mtx_trylock, GLIBC_2_28);
+# endif
+#else /* !PTHREAD_IN_LIBC */
+strong_alias (__mtx_trylock, mtx_trylock)
+#endif