From 8735ea79ab22cad3bd975b507fd6ca4b37094bb8 Mon Sep 17 00:00:00 2001 From: gfleury Date: Thu, 19 Dec 2024 22:37:20 +0200 Subject: [PATCH] htl: move pthread_cond_init into libc. Signed-off-by: gfleury Message-ID: <20241219203727.669825-2-gfleury@disroot.org> --- htl/Makefile | 2 +- htl/Versions | 4 +++- htl/forward.c | 3 --- htl/pt-initialize.c | 1 - sysdeps/htl/pt-cond-init.c | 8 ++++++-- sysdeps/htl/pthread-functions.h | 4 ---- sysdeps/htl/pthreadP.h | 1 + sysdeps/htl/timer_routines.c | 2 +- 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, 13 insertions(+), 15 deletions(-) diff --git a/htl/Makefile b/htl/Makefile index 7f40fd91bf..8dee043975 100644 --- a/htl/Makefile +++ b/htl/Makefile @@ -92,7 +92,6 @@ libpthread-routines := \ pt-rwlock-timedwrlock \ pt-rwlock-unlock \ pt-cond-destroy \ - pt-cond-init \ pt-cond-brdcast \ pt-cond-signal \ pt-cond-wait \ @@ -197,6 +196,7 @@ routines := \ pt-attr-setstackaddr \ pt-attr-setstacksize \ pt-cond \ + pt-cond-init \ pt-condattr-destroy \ pt-condattr-getclock \ pt-condattr-getpshared \ diff --git a/htl/Versions b/htl/Versions index dd786f7947..02d655d6bd 100644 --- a/htl/Versions +++ b/htl/Versions @@ -26,6 +26,7 @@ libc { pthread_attr_setscope; pthread_attr_setschedparam; pthread_attr_init; + pthread_cond_init; pthread_condattr_getclock; pthread_condattr_init; pthread_condattr_destroy; @@ -94,6 +95,7 @@ libc { __pthread_attr_setstacksize; __pthread_attr_setstackaddr; __pthread_attr_setstack; + __pthread_cond_init; __pthread_condattr_init; __pthread_default_condattr; __pthread_sigstate; @@ -133,7 +135,7 @@ libpthread { pthread_cancel; - pthread_cond_broadcast; pthread_cond_destroy; pthread_cond_init; + pthread_cond_broadcast; pthread_cond_destroy; 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 48825de0b0..eb83eaeda1 100644 --- a/htl/forward.c +++ b/htl/forward.c @@ -55,9 +55,6 @@ name decl \ FORWARD (pthread_cond_broadcast, (pthread_cond_t *cond), (cond), 0) FORWARD (pthread_cond_destroy, (pthread_cond_t *cond), (cond), 0) -FORWARD (pthread_cond_init, - (pthread_cond_t *cond, const pthread_condattr_t *cond_attr), - (cond, cond_attr), 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 ae721f3a13..051bc09e94 100644 --- a/htl/pt-initialize.c +++ b/htl/pt-initialize.c @@ -29,7 +29,6 @@ static const struct pthread_functions pthread_functions = { .ptr_pthread_cond_broadcast = __pthread_cond_broadcast, .ptr_pthread_cond_destroy = __pthread_cond_destroy, - .ptr_pthread_cond_init = __pthread_cond_init, .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-init.c b/sysdeps/htl/pt-cond-init.c index 463e42cede..73ca94e3b7 100644 --- a/sysdeps/htl/pt-cond-init.c +++ b/sysdeps/htl/pt-cond-init.c @@ -19,7 +19,7 @@ #include #include #include - +#include #include int @@ -43,5 +43,9 @@ __pthread_cond_init (pthread_cond_t *cond, const pthread_condattr_t * attr) *cond->__attr = *attr; return 0; } +libc_hidden_def (__pthread_cond_init) +versioned_symbol (libc, __pthread_cond_init, pthread_cond_init, GLIBC_2_21); -weak_alias (__pthread_cond_init, pthread_cond_init); +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_21) +compat_symbol (libc, __pthread_cond_init, pthread_cond_init, GLIBC_2_12); +#endif diff --git a/sysdeps/htl/pthread-functions.h b/sysdeps/htl/pthread-functions.h index 8ee01d3ff4..87e75ca804 100644 --- a/sysdeps/htl/pthread-functions.h +++ b/sysdeps/htl/pthread-functions.h @@ -23,8 +23,6 @@ int __pthread_cond_broadcast (pthread_cond_t *); int __pthread_cond_destroy (pthread_cond_t *); -int __pthread_cond_init (pthread_cond_t *, - const pthread_condattr_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 *, @@ -58,8 +56,6 @@ struct pthread_functions { int (*ptr_pthread_cond_broadcast) (pthread_cond_t *); int (*ptr_pthread_cond_destroy) (pthread_cond_t *); - int (*ptr_pthread_cond_init) (pthread_cond_t *, - const pthread_condattr_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 adb81bc241..64c86623c7 100644 --- a/sysdeps/htl/pthreadP.h +++ b/sysdeps/htl/pthreadP.h @@ -43,6 +43,7 @@ extern int __pthread_mutexattr_settype (pthread_mutexattr_t *attr, int kind); extern int __pthread_cond_init (pthread_cond_t *cond, const pthread_condattr_t *cond_attr); +libc_hidden_proto (__pthread_cond_init) extern int __pthread_cond_signal (pthread_cond_t *cond); extern int __pthread_cond_broadcast (pthread_cond_t *cond); extern int __pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex); diff --git a/sysdeps/htl/timer_routines.c b/sysdeps/htl/timer_routines.c index 3a63de6bbb..0992ea3911 100644 --- a/sysdeps/htl/timer_routines.c +++ b/sysdeps/htl/timer_routines.c @@ -151,7 +151,7 @@ thread_init (struct thread_node *thread, const pthread_attr_t *attr, clockid_t c thread->exists = 0; INIT_LIST_HEAD (&thread->timer_queue); - pthread_cond_init (&thread->cond, 0); + __pthread_cond_init (&thread->cond, 0); thread->current_timer = 0; thread->captured = pthread_self (); thread->clock_id = clock_id; diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist index f4613aadac..d5520a0658 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_init F GLIBC_2.12 pthread_condattr_destroy F GLIBC_2.12 pthread_condattr_getclock F GLIBC_2.12 pthread_condattr_getpshared F diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist index e5b3edbed7..77eddcfe93 100644 --- a/sysdeps/mach/hurd/i386/libpthread.abilist +++ b/sysdeps/mach/hurd/i386/libpthread.abilist @@ -32,7 +32,6 @@ 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_destroy F -GLIBC_2.12 pthread_cond_init 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 89a6304354..25bcc9dbea 100644 --- a/sysdeps/mach/hurd/x86_64/libpthread.abilist +++ b/sysdeps/mach/hurd/x86_64/libpthread.abilist @@ -51,7 +51,6 @@ 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_destroy F -GLIBC_2.38 pthread_cond_init F GLIBC_2.38 pthread_cond_signal F GLIBC_2.38 pthread_cond_timedwait F GLIBC_2.38 pthread_cond_wait F