htl: move pthread_rwlock_tryrdlock, pthread_rwlock_trywrlock into libc.

Signed-off-by: gfleury <gfleury@disroot.org>
Message-ID: <20250216145434.7089-6-gfleury@disroot.org>
This commit is contained in:
gfleury 2025-02-16 16:54:29 +02:00 committed by Samuel Thibault
parent 4b25413df5
commit 18accc19b9
9 changed files with 32 additions and 15 deletions

View File

@ -48,8 +48,6 @@ libpthread-routines := \
pt-rwlock-init \
pt-rwlock-destroy \
pt-rwlock-rdlock \
pt-rwlock-tryrdlock \
pt-rwlock-trywrlock \
pt-rwlock-wrlock \
pt-rwlock-timedrdlock \
pt-rwlock-timedwrlock \
@ -197,6 +195,8 @@ routines := \
pt-nthreads \
pt-pthread_self \
pt-rwlock-attr \
pt-rwlock-tryrdlock \
pt-rwlock-trywrlock \
pt-rwlockattr-destroy \
pt-rwlockattr-getpshared \
pt-rwlockattr-init \

View File

@ -63,6 +63,8 @@ libc {
pthread_mutexattr_setprotocol;
pthread_mutexattr_setpshared;
pthread_mutexattr_settype;
pthread_rwlock_tryrdlock;
pthread_rwlock_trywrlock;
pthread_rwlockattr_destroy;
pthread_rwlockattr_getpshared;
pthread_rwlockattr_init;
@ -146,6 +148,8 @@ libc {
pthread_mutex_getprioceiling;
pthread_mutex_setprioceiling;
pthread_mutex_trylock;
pthread_rwlock_tryrdlock;
pthread_rwlock_trywrlock;
pthread_rwlockattr_destroy;
pthread_rwlockattr_getpshared;
pthread_rwlockattr_init;
@ -247,7 +251,6 @@ libpthread {
pthread_rwlock_destroy; pthread_rwlock_init; pthread_rwlock_rdlock;
pthread_rwlock_timedrdlock; pthread_rwlock_timedwrlock;
pthread_rwlock_tryrdlock; pthread_rwlock_trywrlock;
pthread_rwlock_unlock; pthread_rwlock_wrlock;
pthread_setconcurrency;

View File

@ -98,10 +98,12 @@ extern int __pthread_rwlock_destroy (pthread_rwlock_t *__rwlock);
extern int __pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock);
extern int __pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock);
libc_hidden_proto (__pthread_rwlock_tryrdlock)
extern int __pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock);
extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock);
libc_hidden_proto (__pthread_rwlock_trywrlock)
extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock);
@ -121,9 +123,7 @@ libc_hidden_proto (__pthread_setcancelstate)
weak_extern (__pthread_rwlock_init)
weak_extern (__pthread_rwlock_destroy)
weak_extern (__pthread_rwlock_rdlock)
weak_extern (__pthread_rwlock_tryrdlock)
weak_extern (__pthread_rwlock_wrlock)
weak_extern (__pthread_rwlock_trywrlock)
weak_extern (__pthread_rwlock_unlock)
weak_extern (__pthread_key_create)
weak_extern (__pthread_setspecific)
@ -134,9 +134,7 @@ weak_extern (__pthread_atfork)
# else
# pragma weak __pthread_rwlock_destroy
# pragma weak __pthread_rwlock_rdlock
# pragma weak __pthread_rwlock_tryrdlock
# pragma weak __pthread_rwlock_wrlock
# pragma weak __pthread_rwlock_trywrlock
# pragma weak __pthread_rwlock_unlock
# pragma weak __pthread_key_create
# pragma weak __pthread_setspecific

View File

@ -18,12 +18,12 @@
#include <pthread.h>
#include <assert.h>
#include <pt-internal.h>
#include <shlib-compat.h>
/* Try to acquire RWLOCK. */
int
pthread_rwlock_tryrdlock (struct __pthread_rwlock *rwlock)
__pthread_rwlock_tryrdlock (struct __pthread_rwlock *rwlock)
{
__pthread_spin_wait (&rwlock->__lock);
if (__pthread_spin_trylock (&rwlock->__held) == 0)
@ -53,3 +53,9 @@ pthread_rwlock_tryrdlock (struct __pthread_rwlock *rwlock)
return EBUSY;
}
libc_hidden_def (__pthread_rwlock_tryrdlock)
versioned_symbol (libc, __pthread_rwlock_tryrdlock, pthread_rwlock_tryrdlock, GLIBC_2_42);
#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_42)
compat_symbol (libpthread, __pthread_rwlock_tryrdlock, pthread_rwlock_tryrdlock, GLIBC_2_12);
#endif

View File

@ -18,12 +18,12 @@
#include <pthread.h>
#include <assert.h>
#include <pt-internal.h>
#include <shlib-compat.h>
/* Try to acquire RWLOCK for writing. */
int
pthread_rwlock_trywrlock (struct __pthread_rwlock *rwlock)
__pthread_rwlock_trywrlock (struct __pthread_rwlock *rwlock)
{
__pthread_spin_wait (&rwlock->__lock);
if (__pthread_spin_trylock (&rwlock->__held) == 0)
@ -43,3 +43,9 @@ pthread_rwlock_trywrlock (struct __pthread_rwlock *rwlock)
return EBUSY;
}
libc_hidden_def (__pthread_rwlock_trywrlock)
versioned_symbol (libc, __pthread_rwlock_trywrlock, pthread_rwlock_trywrlock, GLIBC_2_42);
#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_42)
compat_symbol (libpthread, __pthread_rwlock_trywrlock, pthread_rwlock_trywrlock, GLIBC_2_12);
#endif

View File

@ -88,6 +88,8 @@ GLIBC_2.12 pthread_mutexattr_setprioceiling F
GLIBC_2.12 pthread_mutexattr_setprotocol F
GLIBC_2.12 pthread_mutexattr_setpshared F
GLIBC_2.12 pthread_mutexattr_settype F
GLIBC_2.12 pthread_rwlock_tryrdlock F
GLIBC_2.12 pthread_rwlock_trywrlock F
GLIBC_2.12 pthread_rwlockattr_destroy F
GLIBC_2.12 pthread_rwlockattr_getpshared F
GLIBC_2.12 pthread_rwlockattr_init F
@ -2584,6 +2586,8 @@ GLIBC_2.42 pthread_mutex_consistent_np F
GLIBC_2.42 pthread_mutex_getprioceiling F
GLIBC_2.42 pthread_mutex_setprioceiling F
GLIBC_2.42 pthread_mutex_trylock F
GLIBC_2.42 pthread_rwlock_tryrdlock F
GLIBC_2.42 pthread_rwlock_trywrlock F
GLIBC_2.42 pthread_rwlockattr_destroy F
GLIBC_2.42 pthread_rwlockattr_getpshared F
GLIBC_2.42 pthread_rwlockattr_init F

View File

@ -41,8 +41,6 @@ GLIBC_2.12 pthread_rwlock_init F
GLIBC_2.12 pthread_rwlock_rdlock F
GLIBC_2.12 pthread_rwlock_timedrdlock F
GLIBC_2.12 pthread_rwlock_timedwrlock F
GLIBC_2.12 pthread_rwlock_tryrdlock F
GLIBC_2.12 pthread_rwlock_trywrlock F
GLIBC_2.12 pthread_rwlock_unlock F
GLIBC_2.12 pthread_rwlock_wrlock F
GLIBC_2.12 pthread_setconcurrency F

View File

@ -1579,6 +1579,8 @@ GLIBC_2.38 pthread_mutexattr_setpshared F
GLIBC_2.38 pthread_mutexattr_setrobust F
GLIBC_2.38 pthread_mutexattr_setrobust_np F
GLIBC_2.38 pthread_mutexattr_settype F
GLIBC_2.38 pthread_rwlock_tryrdlock F
GLIBC_2.38 pthread_rwlock_trywrlock F
GLIBC_2.38 pthread_rwlockattr_destroy F
GLIBC_2.38 pthread_rwlockattr_getpshared F
GLIBC_2.38 pthread_rwlockattr_init F
@ -2267,6 +2269,8 @@ GLIBC_2.42 pthread_mutex_consistent_np F
GLIBC_2.42 pthread_mutex_getprioceiling F
GLIBC_2.42 pthread_mutex_setprioceiling F
GLIBC_2.42 pthread_mutex_trylock F
GLIBC_2.42 pthread_rwlock_tryrdlock F
GLIBC_2.42 pthread_rwlock_trywrlock F
GLIBC_2.42 pthread_rwlockattr_destroy F
GLIBC_2.42 pthread_rwlockattr_getpshared F
GLIBC_2.42 pthread_rwlockattr_init F

View File

@ -63,8 +63,6 @@ GLIBC_2.38 pthread_rwlock_init F
GLIBC_2.38 pthread_rwlock_rdlock F
GLIBC_2.38 pthread_rwlock_timedrdlock F
GLIBC_2.38 pthread_rwlock_timedwrlock F
GLIBC_2.38 pthread_rwlock_tryrdlock F
GLIBC_2.38 pthread_rwlock_trywrlock F
GLIBC_2.38 pthread_rwlock_unlock F
GLIBC_2.38 pthread_rwlock_wrlock F
GLIBC_2.38 pthread_setconcurrency F