[PATCH 07/10] htl: move pthread_rwlock_{rdlock, timedrdlock, timedwrlock, wrlock, clockrdlock, clockwrlock} into libc.

gfleury gfleury@disroot.org
Sat Feb 15 12:50:10 GMT 2025


Signed-off-by: gfleury <gfleury@disroot.org>
---
 htl/Makefile                                |  8 ++++----
 htl/Versions                                | 12 +++++++-----
 htl/pt-initialize.c                         |  2 --
 sysdeps/htl/libc-lockP.h                    |  6 ++----
 sysdeps/htl/pt-rwlock-rdlock.c              |  1 +
 sysdeps/htl/pt-rwlock-timedrdlock.c         |  2 ++
 sysdeps/htl/pt-rwlock-timedwrlock.c         |  2 ++
 sysdeps/htl/pt-rwlock-wrlock.c              |  1 +
 sysdeps/htl/pthread-functions.h             |  4 ----
 sysdeps/htl/pthreadP.h                      | 12 ++++++++++++
 sysdeps/mach/hurd/i386/libc.abilist         |  6 ++++++
 sysdeps/mach/hurd/i386/libpthread.abilist   |  6 ------
 sysdeps/mach/hurd/x86_64/libc.abilist       |  6 ++++++
 sysdeps/mach/hurd/x86_64/libpthread.abilist |  6 ------
 14 files changed, 43 insertions(+), 31 deletions(-)

diff --git a/htl/Makefile b/htl/Makefile
index 6e49e2ba..83b2ba3a 100644
--- a/htl/Makefile
+++ b/htl/Makefile
@@ -47,10 +47,6 @@ libpthread-routines := \
   pt-mutex-transfer-np \
   pt-rwlock-init \
   pt-rwlock-destroy \
-  pt-rwlock-rdlock \
-  pt-rwlock-wrlock \
-  pt-rwlock-timedrdlock \
-  pt-rwlock-timedwrlock \
   pt-hurd-cond-wait \
   pt-hurd-cond-timedwait \
   pt-stack-alloc \
@@ -193,9 +189,13 @@ routines := \
   pt-mutexattr-settype \
   pt-nthreads \
   pt-rwlock-attr \
+  pt-rwlock-rdlock \
+  pt-rwlock-timedrdlock \
+  pt-rwlock-timedwrlock \
   pt-rwlock-tryrdlock \
   pt-rwlock-trywrlock \
   pt-rwlock-unlock \
+  pt-rwlock-wrlock \
   pt-rwlockattr-destroy \
   pt-rwlockattr-getpshared \
   pt-rwlockattr-init \
diff --git a/htl/Versions b/htl/Versions
index dff7fd9f..80b4cb1a 100644
--- a/htl/Versions
+++ b/htl/Versions
@@ -63,9 +63,13 @@ libc {
     pthread_mutexattr_setprotocol;
     pthread_mutexattr_setpshared;
     pthread_mutexattr_settype;
+    pthread_rwlock_rdlock;
+    pthread_rwlock_timedrdlock;
+    pthread_rwlock_timedwrlock;
     pthread_rwlock_tryrdlock;
     pthread_rwlock_trywrlock;
     pthread_rwlock_unlock;
+    pthread_rwlock_wrlock;
     pthread_rwlockattr_destroy;
     pthread_rwlockattr_getpshared;
     pthread_rwlockattr_init;
@@ -109,6 +113,8 @@ libc {
 
     pthread_mutexattr_getrobust; pthread_mutexattr_getrobust_np;
     pthread_mutexattr_setrobust; pthread_mutexattr_setrobust_np;
+
+    pthread_rwlock_clockrdlock; pthread_rwlock_clockwrlock;
   }
 
   GLIBC_2.41 {
@@ -250,9 +256,7 @@ libpthread {
 
     pthread_once;
 
-    pthread_rwlock_destroy; pthread_rwlock_init; pthread_rwlock_rdlock;
-    pthread_rwlock_timedrdlock; pthread_rwlock_timedwrlock;
-    pthread_rwlock_wrlock;
+    pthread_rwlock_destroy; pthread_rwlock_init;
 
     pthread_setconcurrency;
     pthread_setschedprio; pthread_setspecific;
@@ -282,8 +286,6 @@ libpthread {
     cnd_broadcast; cnd_destroy; cnd_init; cnd_signal; cnd_timedwait; cnd_wait;
     tss_create; tss_delete; tss_get; tss_set;
 
-    pthread_rwlock_clockrdlock; pthread_rwlock_clockwrlock;
-
     pthread_tryjoin_np; pthread_timedjoin_np; pthread_clockjoin_np;
 
     sem_clockwait;
diff --git a/htl/pt-initialize.c b/htl/pt-initialize.c
index 14172099..658ba1ea 100644
--- a/htl/pt-initialize.c
+++ b/htl/pt-initialize.c
@@ -30,8 +30,6 @@ static const struct pthread_functions pthread_functions = {
   .ptr___pthread_exit = __pthread_exit,
   .ptr___pthread_get_cleanup_stack = __pthread_get_cleanup_stack,
   .ptr_pthread_once = __pthread_once,
-  .ptr_pthread_rwlock_rdlock = __pthread_rwlock_rdlock,
-  .ptr_pthread_rwlock_wrlock = __pthread_rwlock_wrlock,
   .ptr___pthread_key_create = __pthread_key_create,
   .ptr___pthread_getspecific = __pthread_getspecific,
   .ptr___pthread_setspecific = __pthread_setspecific,
diff --git a/sysdeps/htl/libc-lockP.h b/sysdeps/htl/libc-lockP.h
index 7e9bdd1c..ae2e4668 100644
--- a/sysdeps/htl/libc-lockP.h
+++ b/sysdeps/htl/libc-lockP.h
@@ -96,11 +96,13 @@ extern int __pthread_rwlock_init (pthread_rwlock_t *__rwlock,
 extern int __pthread_rwlock_destroy (pthread_rwlock_t *__rwlock);
 
 extern int __pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock);
+libc_hidden_proto (__pthread_rwlock_rdlock)
 
 extern int __pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock);
 libc_hidden_proto (__pthread_rwlock_tryrdlock)
 
 extern int __pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock);
+libc_hidden_proto (__pthread_rwlock_wrlock)
 
 extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock);
 libc_hidden_proto (__pthread_rwlock_trywrlock)
@@ -123,8 +125,6 @@ libc_hidden_proto (__pthread_setcancelstate)
 # ifdef weak_extern
 weak_extern (__pthread_rwlock_init)
 weak_extern (__pthread_rwlock_destroy)
-weak_extern (__pthread_rwlock_rdlock)
-weak_extern (__pthread_rwlock_wrlock)
 weak_extern (__pthread_key_create)
 weak_extern (__pthread_setspecific)
 weak_extern (__pthread_getspecific)
@@ -133,8 +133,6 @@ weak_extern (__pthread_initialize)
 weak_extern (__pthread_atfork)
 # else
 #  pragma weak __pthread_rwlock_destroy
-#  pragma weak __pthread_rwlock_rdlock
-#  pragma weak __pthread_rwlock_wrlock
 #  pragma weak __pthread_key_create
 #  pragma weak __pthread_setspecific
 #  pragma weak __pthread_getspecific
diff --git a/sysdeps/htl/pt-rwlock-rdlock.c b/sysdeps/htl/pt-rwlock-rdlock.c
index a2f6e47b..b2b449c1 100644
--- a/sysdeps/htl/pt-rwlock-rdlock.c
+++ b/sysdeps/htl/pt-rwlock-rdlock.c
@@ -32,4 +32,5 @@ __pthread_rwlock_rdlock (struct __pthread_rwlock *rwlock)
 {
   return __pthread_rwlock_timedrdlock_internal (rwlock, -1, 0);
 }
+libc_hidden_def (__pthread_rwlock_rdlock)
 weak_alias (__pthread_rwlock_rdlock, pthread_rwlock_rdlock);
diff --git a/sysdeps/htl/pt-rwlock-timedrdlock.c b/sysdeps/htl/pt-rwlock-timedrdlock.c
index 3c900e66..218e9123 100644
--- a/sysdeps/htl/pt-rwlock-timedrdlock.c
+++ b/sysdeps/htl/pt-rwlock-timedrdlock.c
@@ -122,6 +122,7 @@ __pthread_rwlock_timedrdlock (struct __pthread_rwlock *rwlock,
 {
   return __pthread_rwlock_timedrdlock_internal (rwlock, CLOCK_REALTIME, abstime);
 }
+libc_hidden_def (__pthread_rwlock_timedrdlock)
 weak_alias (__pthread_rwlock_timedrdlock, pthread_rwlock_timedrdlock)
 
 int
@@ -131,4 +132,5 @@ __pthread_rwlock_clockrdlock (struct __pthread_rwlock *rwlock,
 {
   return __pthread_rwlock_timedrdlock_internal (rwlock, clockid, abstime);
 }
+libc_hidden_def (__pthread_rwlock_clockrdlock)
 weak_alias (__pthread_rwlock_clockrdlock, pthread_rwlock_clockrdlock)
diff --git a/sysdeps/htl/pt-rwlock-timedwrlock.c b/sysdeps/htl/pt-rwlock-timedwrlock.c
index 3780119d..fad6401e 100644
--- a/sysdeps/htl/pt-rwlock-timedwrlock.c
+++ b/sysdeps/htl/pt-rwlock-timedwrlock.c
@@ -105,6 +105,7 @@ __pthread_rwlock_timedwrlock (struct __pthread_rwlock *rwlock,
 {
   return __pthread_rwlock_timedwrlock_internal (rwlock, CLOCK_REALTIME, abstime);
 }
+libc_hidden_def (__pthread_rwlock_timedwrlock)
 weak_alias (__pthread_rwlock_timedwrlock, pthread_rwlock_timedwrlock)
 
 int
@@ -114,4 +115,5 @@ __pthread_rwlock_clockwrlock (struct __pthread_rwlock *rwlock,
 {
   return __pthread_rwlock_timedwrlock_internal (rwlock, clockid, abstime);
 }
+libc_hidden_def (__pthread_rwlock_clockwrlock)
 weak_alias (__pthread_rwlock_clockwrlock, pthread_rwlock_clockwrlock)
diff --git a/sysdeps/htl/pt-rwlock-wrlock.c b/sysdeps/htl/pt-rwlock-wrlock.c
index 181aa6a9..325e97e1 100644
--- a/sysdeps/htl/pt-rwlock-wrlock.c
+++ b/sysdeps/htl/pt-rwlock-wrlock.c
@@ -34,4 +34,5 @@ __pthread_rwlock_wrlock (struct __pthread_rwlock *rwlock)
 {
   return __pthread_rwlock_timedwrlock_internal (rwlock, -1, 0);
 }
+libc_hidden_def (__pthread_rwlock_wrlock)
 weak_alias (__pthread_rwlock_wrlock, pthread_rwlock_wrlock);
diff --git a/sysdeps/htl/pthread-functions.h b/sysdeps/htl/pthread-functions.h
index 7dd6fadc..467d0312 100644
--- a/sysdeps/htl/pthread-functions.h
+++ b/sysdeps/htl/pthread-functions.h
@@ -24,8 +24,6 @@
 void __pthread_exit (void *) __attribute__ ((__noreturn__));
 struct __pthread_cancelation_handler **__pthread_get_cleanup_stack (void);
 int __pthread_once (pthread_once_t *, void (*) (void));
-int __pthread_rwlock_rdlock (pthread_rwlock_t *);
-int __pthread_rwlock_wrlock (pthread_rwlock_t *);
 int __pthread_key_create (pthread_key_t *, void (*) (void *));
 void *__pthread_getspecific (pthread_key_t);
 int __pthread_setspecific (pthread_key_t, const void *);
@@ -42,8 +40,6 @@ struct pthread_functions
   void (*ptr___pthread_exit) (void *) __attribute__ ((__noreturn__));
   struct __pthread_cancelation_handler **(*ptr___pthread_get_cleanup_stack) (void);
   int (*ptr_pthread_once) (pthread_once_t *, void (*) (void));
-  int (*ptr_pthread_rwlock_rdlock) (pthread_rwlock_t *);
-  int (*ptr_pthread_rwlock_wrlock) (pthread_rwlock_t *);
   int (*ptr___pthread_key_create) (pthread_key_t *, void (*) (void *));
   void *(*ptr___pthread_getspecific) (pthread_key_t);
   int (*ptr___pthread_setspecific) (pthread_key_t, const void *);
diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h
index d77cee51..9479b9ef 100644
--- a/sysdeps/htl/pthreadP.h
+++ b/sysdeps/htl/pthreadP.h
@@ -114,6 +114,18 @@ libc_hidden_proto (__pthread_mutexattr_gettype)
 extern int __pthread_mutexattr_settype(pthread_mutexattr_t *__attr,
 				     int __type);
 libc_hidden_proto (__pthread_mutexattr_settype)
+extern int __pthread_rwlock_clockrdlock (pthread_rwlock_t *__rwlock,
+				       clockid_t __clockid, const struct timespec *__abstime);
+libc_hidden_proto (__pthread_rwlock_clockrdlock)
+extern int __pthread_rwlock_clockwrlock (pthread_rwlock_t *__rwlock,
+				       clockid_t __clockid, const struct timespec *__abstime);
+libc_hidden_proto (__pthread_rwlock_clockwrlock)
+extern int __pthread_rwlock_timedrdlock (struct __pthread_rwlock *__rwlock,
+				       const struct timespec *__abstime);
+libc_hidden_proto (__pthread_rwlock_timedrdlock)
+extern int __pthread_rwlock_timedwrlock (struct __pthread_rwlock *__rwlock,
+				       const struct timespec *__abstime);
+libc_hidden_proto (__pthread_rwlock_timedwrlock)
 extern int __pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr);
 libc_hidden_proto (__pthread_rwlockattr_destroy)
 extern int __pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *__attr,
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index 2709614e..0e304491 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -88,9 +88,13 @@ 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_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_rwlockattr_destroy F
 GLIBC_2.12 pthread_rwlockattr_getpshared F
 GLIBC_2.12 pthread_rwlockattr_init F
@@ -2294,6 +2298,8 @@ GLIBC_2.32 pthread_mutexattr_getrobust F
 GLIBC_2.32 pthread_mutexattr_getrobust_np F
 GLIBC_2.32 pthread_mutexattr_setrobust F
 GLIBC_2.32 pthread_mutexattr_setrobust_np F
+GLIBC_2.32 pthread_rwlock_clockrdlock F
+GLIBC_2.32 pthread_rwlock_clockwrlock F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist
index 8ba641f6..1b4cfa5f 100644
--- a/sysdeps/mach/hurd/i386/libpthread.abilist
+++ b/sysdeps/mach/hurd/i386/libpthread.abilist
@@ -38,10 +38,6 @@ GLIBC_2.12 pthread_mutex_transfer_np F
 GLIBC_2.12 pthread_once F
 GLIBC_2.12 pthread_rwlock_destroy F
 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_wrlock F
 GLIBC_2.12 pthread_setconcurrency F
 GLIBC_2.12 pthread_setschedprio F
 GLIBC_2.12 pthread_setspecific F
@@ -83,8 +79,6 @@ GLIBC_2.32 mtx_timedlock F
 GLIBC_2.32 mtx_trylock F
 GLIBC_2.32 mtx_unlock F
 GLIBC_2.32 pthread_clockjoin_np F
-GLIBC_2.32 pthread_rwlock_clockrdlock F
-GLIBC_2.32 pthread_rwlock_clockwrlock F
 GLIBC_2.32 pthread_timedjoin_np F
 GLIBC_2.32 pthread_tryjoin_np F
 GLIBC_2.32 sem_clockwait F
diff --git a/sysdeps/mach/hurd/x86_64/libc.abilist b/sysdeps/mach/hurd/x86_64/libc.abilist
index 2b8c01fc..55a97e95 100644
--- a/sysdeps/mach/hurd/x86_64/libc.abilist
+++ b/sysdeps/mach/hurd/x86_64/libc.abilist
@@ -1579,9 +1579,15 @@ 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_clockrdlock F
+GLIBC_2.38 pthread_rwlock_clockwrlock 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_rwlockattr_destroy F
 GLIBC_2.38 pthread_rwlockattr_getpshared F
 GLIBC_2.38 pthread_rwlockattr_init F
diff --git a/sysdeps/mach/hurd/x86_64/libpthread.abilist b/sysdeps/mach/hurd/x86_64/libpthread.abilist
index cd08c5f9..32b0b502 100644
--- a/sysdeps/mach/hurd/x86_64/libpthread.abilist
+++ b/sysdeps/mach/hurd/x86_64/libpthread.abilist
@@ -56,14 +56,8 @@ GLIBC_2.38 pthread_key_delete F
 GLIBC_2.38 pthread_kill F
 GLIBC_2.38 pthread_mutex_transfer_np F
 GLIBC_2.38 pthread_once F
-GLIBC_2.38 pthread_rwlock_clockrdlock F
-GLIBC_2.38 pthread_rwlock_clockwrlock F
 GLIBC_2.38 pthread_rwlock_destroy F
 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_wrlock F
 GLIBC_2.38 pthread_setconcurrency F
 GLIBC_2.38 pthread_setschedprio F
 GLIBC_2.38 pthread_setspecific F
-- 
2.39.5



More information about the Libc-alpha mailing list