From 3089d23517a0d93c645edd5129e08e8432fc3563 Mon Sep 17 00:00:00 2001 From: gfleury Date: Thu, 19 Dec 2024 22:37:23 +0200 Subject: [PATCH] htl: move pthread_cond_broadcast into libc. Signed-off-by: gfleury Message-ID: <20241219203727.669825-5-gfleury@disroot.org> --- htl/Makefile | 2 +- htl/Versions | 3 ++- htl/forward.c | 1 - htl/pt-initialize.c | 1 - sysdeps/htl/pt-cond-brdcast.c | 8 ++++++-- sysdeps/htl/pthread-functions.h | 2 -- sysdeps/htl/pthreadP.h | 1 + sysdeps/htl/timer_routines.c | 6 +++--- sysdeps/mach/hurd/i386/libc.abilist | 1 + sysdeps/mach/hurd/i386/libpthread.abilist | 1 - sysdeps/mach/hurd/x86_64/libpthread.abilist | 1 - 11 files changed, 14 insertions(+), 13 deletions(-) diff --git a/htl/Makefile b/htl/Makefile index c61112d667..629a8a5359 100644 --- a/htl/Makefile +++ b/htl/Makefile @@ -91,7 +91,6 @@ libpthread-routines := \ pt-rwlock-timedrdlock \ pt-rwlock-timedwrlock \ pt-rwlock-unlock \ - pt-cond-brdcast \ pt-cond-signal \ pt-cond-wait \ pt-cond-timedwait \ @@ -194,6 +193,7 @@ routines := \ pt-attr-setstackaddr \ pt-attr-setstacksize \ pt-cond \ + pt-cond-brdcast \ pt-cond-destroy \ pt-cond-init \ pt-condattr-destroy \ diff --git a/htl/Versions b/htl/Versions index 30f7d03aeb..6348800117 100644 --- a/htl/Versions +++ b/htl/Versions @@ -26,6 +26,7 @@ libc { pthread_attr_setscope; pthread_attr_setschedparam; pthread_attr_init; + pthread_cond_broadcast; pthread_cond_destroy; pthread_cond_init; pthread_condattr_getclock; @@ -96,6 +97,7 @@ libc { __pthread_attr_setstacksize; __pthread_attr_setstackaddr; __pthread_attr_setstack; + __pthread_cond_broadcast; __pthread_cond_destroy; __pthread_cond_init; __pthread_condattr_init; @@ -138,7 +140,6 @@ libpthread { pthread_cancel; - pthread_cond_broadcast; pthread_cond_signal; pthread_cond_timedwait; pthread_cond_wait; pthread_create; pthread_detach; pthread_exit; diff --git a/htl/forward.c b/htl/forward.c index 7731b84d04..6c83a2e76c 100644 --- a/htl/forward.c +++ b/htl/forward.c @@ -53,7 +53,6 @@ name decl \ #define FORWARD(name, decl, params, defretval) \ FORWARD2 (name, int, decl, params, return defretval) -FORWARD (pthread_cond_broadcast, (pthread_cond_t *cond), (cond), 0) FORWARD (pthread_cond_signal, (pthread_cond_t *cond), (cond), 0) FORWARD (pthread_cond_wait, (pthread_cond_t *cond, pthread_mutex_t *mutex), (cond, mutex), 0) diff --git a/htl/pt-initialize.c b/htl/pt-initialize.c index 1b147b947a..c0929a1498 100644 --- a/htl/pt-initialize.c +++ b/htl/pt-initialize.c @@ -27,7 +27,6 @@ #if IS_IN (libpthread) static const struct pthread_functions pthread_functions = { - .ptr_pthread_cond_broadcast = __pthread_cond_broadcast, .ptr_pthread_cond_signal = __pthread_cond_signal, .ptr_pthread_cond_wait = __pthread_cond_wait, .ptr_pthread_cond_timedwait = __pthread_cond_timedwait, diff --git a/sysdeps/htl/pt-cond-brdcast.c b/sysdeps/htl/pt-cond-brdcast.c index a0071740df..baa4fc5eec 100644 --- a/sysdeps/htl/pt-cond-brdcast.c +++ b/sysdeps/htl/pt-cond-brdcast.c @@ -17,7 +17,7 @@ . */ #include - +#include #include /* Unblock all threads that are blocked on condition variable COND. */ @@ -40,5 +40,9 @@ __pthread_cond_broadcast (pthread_cond_t *cond) return 0; } +libc_hidden_def (__pthread_cond_broadcast) +versioned_symbol (libc, __pthread_cond_broadcast, pthread_cond_broadcast, GLIBC_2_21); -weak_alias (__pthread_cond_broadcast, pthread_cond_broadcast); +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_21) +compat_symbol (libc, __pthread_cond_broadcast, pthread_cond_broadcast, GLIBC_2_12); +#endif diff --git a/sysdeps/htl/pthread-functions.h b/sysdeps/htl/pthread-functions.h index 99510615dd..c09a39823e 100644 --- a/sysdeps/htl/pthread-functions.h +++ b/sysdeps/htl/pthread-functions.h @@ -21,7 +21,6 @@ #include -int __pthread_cond_broadcast (pthread_cond_t *); int __pthread_cond_signal (pthread_cond_t *); int __pthread_cond_wait (pthread_cond_t *, pthread_mutex_t *); int __pthread_cond_timedwait (pthread_cond_t *, pthread_mutex_t *, @@ -53,7 +52,6 @@ int _cthreads_ftrylockfile (FILE *); so if possible avoid breaking it and append new hooks to the end. */ struct pthread_functions { - int (*ptr_pthread_cond_broadcast) (pthread_cond_t *); int (*ptr_pthread_cond_signal) (pthread_cond_t *); int (*ptr_pthread_cond_wait) (pthread_cond_t *, pthread_mutex_t *); int (*ptr_pthread_cond_timedwait) (pthread_cond_t *, pthread_mutex_t *, diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h index 6d469b7eff..4138abdd37 100644 --- a/sysdeps/htl/pthreadP.h +++ b/sysdeps/htl/pthreadP.h @@ -46,6 +46,7 @@ extern int __pthread_cond_init (pthread_cond_t *cond, libc_hidden_proto (__pthread_cond_init) extern int __pthread_cond_signal (pthread_cond_t *cond); extern int __pthread_cond_broadcast (pthread_cond_t *cond); +libc_hidden_proto (__pthread_cond_broadcast); extern int __pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex); extern int __pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex, diff --git a/sysdeps/htl/timer_routines.c b/sysdeps/htl/timer_routines.c index 7e2a56139e..1244ce868a 100644 --- a/sysdeps/htl/timer_routines.c +++ b/sysdeps/htl/timer_routines.c @@ -280,7 +280,7 @@ thread_cleanup (void *val) pthread_mutex_unlock (&__timer_mutex); /* Unblock potentially blocked timer_delete(). */ - pthread_cond_broadcast (&thread->cond); + __pthread_cond_broadcast (&thread->cond); } } @@ -338,7 +338,7 @@ thread_expire_timer (struct thread_node *self, struct timer_node *timer) self->current_timer = 0; - pthread_cond_broadcast (&self->cond); + __pthread_cond_broadcast (&self->cond); } @@ -486,7 +486,7 @@ __timer_thread_start (struct thread_node *thread) void __timer_thread_wakeup (struct thread_node *thread) { - pthread_cond_broadcast (&thread->cond); + __pthread_cond_broadcast (&thread->cond); } diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist index e251d09f5d..35ae6bb27f 100644 --- a/sysdeps/mach/hurd/i386/libc.abilist +++ b/sysdeps/mach/hurd/i386/libc.abilist @@ -49,6 +49,7 @@ GLIBC_2.12 pthread_attr_setscope F GLIBC_2.12 pthread_attr_setstack F GLIBC_2.12 pthread_attr_setstackaddr F GLIBC_2.12 pthread_attr_setstacksize F +GLIBC_2.12 pthread_cond_broadcast F GLIBC_2.12 pthread_cond_destroy F GLIBC_2.12 pthread_cond_init F GLIBC_2.12 pthread_condattr_destroy F diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist index b9d13b27eb..fd35a94f02 100644 --- a/sysdeps/mach/hurd/i386/libpthread.abilist +++ b/sysdeps/mach/hurd/i386/libpthread.abilist @@ -30,7 +30,6 @@ GLIBC_2.12 pthread_barrierattr_getpshared F GLIBC_2.12 pthread_barrierattr_init F GLIBC_2.12 pthread_barrierattr_setpshared F GLIBC_2.12 pthread_cancel F -GLIBC_2.12 pthread_cond_broadcast F GLIBC_2.12 pthread_cond_signal F GLIBC_2.12 pthread_cond_timedwait F GLIBC_2.12 pthread_cond_wait F diff --git a/sysdeps/mach/hurd/x86_64/libpthread.abilist b/sysdeps/mach/hurd/x86_64/libpthread.abilist index 154689e859..1bc76cf8e8 100644 --- a/sysdeps/mach/hurd/x86_64/libpthread.abilist +++ b/sysdeps/mach/hurd/x86_64/libpthread.abilist @@ -48,7 +48,6 @@ GLIBC_2.38 pthread_barrierattr_init F GLIBC_2.38 pthread_barrierattr_setpshared F GLIBC_2.38 pthread_cancel F GLIBC_2.38 pthread_clockjoin_np F -GLIBC_2.38 pthread_cond_broadcast F GLIBC_2.38 pthread_cond_clockwait F GLIBC_2.38 pthread_cond_signal F GLIBC_2.38 pthread_cond_timedwait F