diff options
| author | Florian Weimer <fweimer@redhat.com> | 2021-05-03 09:10:57 +0200 |
|---|---|---|
| committer | Florian Weimer <fweimer@redhat.com> | 2021-05-03 09:18:20 +0200 |
| commit | e8a9597159168db43289da50433af0ba3d8a7f92 (patch) | |
| tree | 9669509346b05e4bf95c836faf7b645165bbb292 | |
| parent | c96dddd7311e7ffa2a7995de5c2560d9979fd962 (diff) | |
| download | glibc-e8a9597159168db43289da50433af0ba3d8a7f92.tar.xz glibc-e8a9597159168db43289da50433af0ba3d8a7f92.zip | |
nptl: Move pthread_rwlock_trywrlock into libc
And __pthread_rwlock_trywrlock as a compatibility symbol.
Remove the unused __libc_rwlock_trywrlock macro.
The symbols were moved using scripts/move-symbol-to-libc.py.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
65 files changed, 113 insertions, 68 deletions
diff --git a/nptl/Makefile b/nptl/Makefile index fd0c9fae53..a451f00dd2 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -128,6 +128,7 @@ routines = \ pthread_rwlock_timedrdlock \ pthread_rwlock_timedwrlock \ pthread_rwlock_tryrdlock \ + pthread_rwlock_trywrlock \ pthread_rwlock_unlock \ pthread_rwlock_wrlock \ pthread_self \ @@ -185,7 +186,6 @@ libpthread-routines = \ pthread_getname \ pthread_join \ pthread_join_common \ - pthread_rwlock_trywrlock \ pthread_rwlockattr_destroy \ pthread_rwlockattr_getkind_np \ pthread_rwlockattr_getpshared \ diff --git a/nptl/Versions b/nptl/Versions index 97700cfbd3..3e494060be 100644 --- a/nptl/Versions +++ b/nptl/Versions @@ -70,6 +70,7 @@ libc { pthread_rwlock_init; pthread_rwlock_rdlock; pthread_rwlock_tryrdlock; + pthread_rwlock_trywrlock; pthread_rwlock_unlock; pthread_rwlock_wrlock; } @@ -78,6 +79,7 @@ libc { __pthread_rwlock_init; __pthread_rwlock_rdlock; __pthread_rwlock_tryrdlock; + __pthread_rwlock_trywrlock; __pthread_rwlock_unlock; __pthread_rwlock_wrlock; pthread_condattr_getpshared; @@ -221,6 +223,7 @@ libc { pthread_rwlock_timedrdlock; pthread_rwlock_timedwrlock; pthread_rwlock_tryrdlock; + pthread_rwlock_trywrlock; pthread_rwlock_unlock; pthread_rwlock_wrlock; pthread_setspecific; @@ -309,7 +312,6 @@ libpthread { pthread_attr_setstacksize; pthread_create; pthread_getconcurrency; - pthread_rwlock_trywrlock; pthread_rwlockattr_destroy; pthread_rwlockattr_getkind_np; pthread_rwlockattr_getpshared; @@ -336,7 +338,6 @@ libpthread { } GLIBC_2.2 { - __pthread_rwlock_trywrlock; pthread_attr_getstack; pthread_attr_setstack; pthread_barrier_destroy; diff --git a/nptl/pthread_rwlock_trywrlock.c b/nptl/pthread_rwlock_trywrlock.c index 642fa724f2..242c0a1c5c 100644 --- a/nptl/pthread_rwlock_trywrlock.c +++ b/nptl/pthread_rwlock_trywrlock.c @@ -19,10 +19,11 @@ #include <errno.h> #include "pthreadP.h" #include <atomic.h> +#include <shlib-compat.h> /* See pthread_rwlock_common.c for an overview. */ int -__pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock) +___pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock) { /* When in a trywrlock, we can acquire the write lock if it is in states #1 (idle and read phase) and #5 (idle and write phase), and also in #6 @@ -64,5 +65,15 @@ __pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock) } return EBUSY; } +versioned_symbol (libc, ___pthread_rwlock_trywrlock, + pthread_rwlock_trywrlock, GLIBC_2_34); +libc_hidden_ver (___pthread_rwlock_trywrlock, __pthread_rwlock_trywrlock) -strong_alias (__pthread_rwlock_trywrlock, pthread_rwlock_trywrlock) +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_1, GLIBC_2_34) +compat_symbol (libpthread, ___pthread_rwlock_trywrlock, + pthread_rwlock_trywrlock, GLIBC_2_1); +#endif +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_2, GLIBC_2_34) +compat_symbol (libpthread, ___pthread_rwlock_trywrlock, + __pthread_rwlock_trywrlock, GLIBC_2_2); +#endif diff --git a/sysdeps/nptl/libc-lockP.h b/sysdeps/nptl/libc-lockP.h index 5bb1d5c5be..ae9691d40e 100644 --- a/sysdeps/nptl/libc-lockP.h +++ b/sysdeps/nptl/libc-lockP.h @@ -150,8 +150,6 @@ _Static_assert (LLL_LOCK_INITIALIZER == 0, "LLL_LOCK_INITIALIZER != 0"); # define __libc_lock_trylock(NAME) \ __libc_maybe_call (__pthread_mutex_trylock, (&(NAME)), 0) #endif -#define __libc_rwlock_trywrlock(NAME) \ - __libc_maybe_call (__pthread_rwlock_trywrlock, (&(NAME)), 0) #define __rtld_lock_trylock_recursive(NAME) \ __libc_maybe_call (__pthread_mutex_trylock, (&(NAME).mutex), 0) @@ -269,7 +267,6 @@ libc_hidden_proto (__pthread_rwlock_rdlock) extern int __pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock); libc_hidden_proto (__pthread_rwlock_wrlock) -extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock); extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock); libc_hidden_proto (__pthread_rwlock_unlock) @@ -290,13 +287,11 @@ libc_hidden_proto (__pthread_setcancelstate) # ifdef weak_extern weak_extern (__pthread_mutex_trylock) weak_extern (__pthread_mutexattr_destroy) -weak_extern (__pthread_rwlock_trywrlock) weak_extern (__pthread_initialize) weak_extern (__pthread_atfork) # else # pragma weak __pthread_mutex_trylock # pragma weak __pthread_mutexattr_destroy -# pragma weak __pthread_rwlock_trywrlock # pragma weak __pthread_initialize # pragma weak __pthread_atfork # endif diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist index e280bac89f..1c35fedfcb 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist @@ -354,6 +354,7 @@ GLIBC_2.17 __pthread_rwlock_destroy F GLIBC_2.17 __pthread_rwlock_init F GLIBC_2.17 __pthread_rwlock_rdlock F GLIBC_2.17 __pthread_rwlock_tryrdlock F +GLIBC_2.17 __pthread_rwlock_trywrlock F GLIBC_2.17 __pthread_rwlock_unlock F GLIBC_2.17 __pthread_rwlock_wrlock F GLIBC_2.17 __pthread_setspecific F @@ -1509,6 +1510,7 @@ GLIBC_2.17 pthread_rwlock_rdlock F GLIBC_2.17 pthread_rwlock_timedrdlock F GLIBC_2.17 pthread_rwlock_timedwrlock F GLIBC_2.17 pthread_rwlock_tryrdlock F +GLIBC_2.17 pthread_rwlock_trywrlock F GLIBC_2.17 pthread_rwlock_unlock F GLIBC_2.17 pthread_rwlock_wrlock F GLIBC_2.17 pthread_self F @@ -2319,6 +2321,7 @@ GLIBC_2.34 pthread_rwlock_rdlock F GLIBC_2.34 pthread_rwlock_timedrdlock F GLIBC_2.34 pthread_rwlock_timedwrlock F GLIBC_2.34 pthread_rwlock_tryrdlock F +GLIBC_2.34 pthread_rwlock_trywrlock |
