From patchwork Sun Dec 22 22:59:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 103631 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A845C3858D29 for ; Sun, 22 Dec 2024 23:00:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A845C3858D29 X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (domu-toccata.ens-lyon.fr [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id DDC713858D1E for ; Sun, 22 Dec 2024 22:59:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DDC713858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bounce.ens-lyon.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DDC713858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.77.166.138 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734908399; cv=none; b=EKPFS5hwgsGp6dWwZiu3ySUZBQ+Rqm65AYl1wLdj86LxPhXfylxzmbs8E32Y60GUN8CtxHg6SSib5HrvzM9k2PFRs3ErEyFb2gjoQ6tOw//bpIeFV3i9dWLRzBrG5lW344wKNIyCKD9S57W8dv/GUGQQ8/myCt0/N1kV7fri0v0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734908399; c=relaxed/simple; bh=TxzFz4OvmD2Jv+KbKlJvxJUIR1IQnuLodKcf91IQPdQ=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=cdLyGFlxFPS/tK1VjbABoOTww25nlesEOIIgBhS2H8FVYBIKYMZMvouE4cknfGZ6z5O9yZe5pwZmgE0hYAd9KTYka6W3NC3fXFBns88EY65AgPSaSlllhf89zcCYx1AwK/3NkxX5/1NrV2gLPBT12rmfo8zMgb0WQmcr7Y6zX/M= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DDC713858D1E Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 942AEA479C; Sun, 22 Dec 2024 23:59:55 +0100 (CET) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kgmgFsUwAkRg; Sun, 22 Dec 2024 23:59:55 +0100 (CET) Received: from begin (aamiens-653-1-40-48.w83-192.abo.wanadoo.fr [83.192.199.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 6D755A0315; Sun, 22 Dec 2024 23:59:55 +0100 (CET) Received: from samy by begin with local (Exim 4.98) (envelope-from ) id 1tPUvS-0000000EJGE-2ifj; Sun, 22 Dec 2024 23:59:54 +0100 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: gfleury , commit-hurd@gnu.org Subject: [hurd, commited] htl: move pthread_cond_timedwait, pthread_cond_clockwait, pthread_cond_wait into libc. Date: Sun, 22 Dec 2024 23:59:54 +0100 Message-ID: <20241222225954.3410623-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org From: gfleury Message-ID: <20241219203727.669825-9-gfleury@disroot.org> --- htl/Makefile | 4 ++-- htl/Versions | 11 +++++++---- htl/forward.c | 6 ------ htl/pt-initialize.c | 2 -- sysdeps/htl/pt-cond-timedwait.c | 10 +++++++--- sysdeps/htl/pt-cond-wait.c | 8 ++++++-- sysdeps/htl/pthread-functions.h | 6 ------ sysdeps/htl/pthreadP.h | 3 +++ sysdeps/htl/timer_routines.c | 4 ++-- sysdeps/mach/hurd/i386/libc.abilist | 3 +++ sysdeps/mach/hurd/i386/libpthread.abilist | 3 --- sysdeps/mach/hurd/x86_64/libc.abilist | 1 + sysdeps/mach/hurd/x86_64/libpthread.abilist | 3 --- 13 files changed, 31 insertions(+), 33 deletions(-) diff --git a/htl/Makefile b/htl/Makefile index 1c454d4d3e..8ce32d1702 100644 --- a/htl/Makefile +++ b/htl/Makefile @@ -90,8 +90,6 @@ libpthread-routines := \ pt-rwlock-timedrdlock \ pt-rwlock-timedwrlock \ pt-rwlock-unlock \ - pt-cond-wait \ - pt-cond-timedwait \ pt-hurd-cond-wait \ pt-hurd-cond-timedwait \ pt-stack-alloc \ @@ -193,6 +191,8 @@ routines := \ pt-cond-destroy \ pt-cond-init \ pt-cond-signal \ + pt-cond-timedwait \ + pt-cond-wait \ pt-condattr-destroy \ pt-condattr-getclock \ pt-condattr-getpshared \ diff --git a/htl/Versions b/htl/Versions index 95cf7fe4c2..1492a2a1ca 100644 --- a/htl/Versions +++ b/htl/Versions @@ -30,6 +30,8 @@ libc { pthread_cond_destroy; pthread_cond_init; pthread_cond_signal; + pthread_cond_timedwait; + pthread_cond_wait; pthread_condattr_getclock; pthread_condattr_init; pthread_condattr_destroy; @@ -64,6 +66,8 @@ libc { # C11 thread symbols. GLIBC_2.32 { thrd_current; thrd_equal; thrd_sleep; thrd_yield; + + pthread_cond_clockwait; } GLIBC_2.41 { @@ -103,7 +107,10 @@ libc { __pthread_cond_broadcast; __pthread_cond_destroy; __pthread_cond_init; + __pthread_cond_clockwait; __pthread_cond_signal; + __pthread_cond_timedwait; + __pthread_cond_wait; __pthread_condattr_init; __pthread_default_condattr; __pthread_mutex_checklocked; @@ -147,8 +154,6 @@ libpthread { pthread_cancel; - pthread_cond_timedwait; pthread_cond_wait; - pthread_create; pthread_detach; pthread_exit; pthread_getattr_np; @@ -214,8 +219,6 @@ libpthread { cnd_broadcast; cnd_destroy; cnd_init; cnd_signal; cnd_timedwait; cnd_wait; tss_create; tss_delete; tss_get; tss_set; - pthread_cond_clockwait; - pthread_mutexattr_getrobust; pthread_mutexattr_getrobust_np; pthread_mutexattr_setrobust; pthread_mutexattr_setrobust_np; diff --git a/htl/forward.c b/htl/forward.c index 78758cef62..29f5528099 100644 --- a/htl/forward.c +++ b/htl/forward.c @@ -53,12 +53,6 @@ name decl \ #define FORWARD(name, decl, params, defretval) \ FORWARD2 (name, int, decl, params, return defretval) -FORWARD (pthread_cond_wait, (pthread_cond_t *cond, pthread_mutex_t *mutex), - (cond, mutex), 0) -FORWARD (pthread_cond_timedwait, - (pthread_cond_t *cond, pthread_mutex_t *mutex, - const struct timespec *abstime), (cond, mutex, abstime), 0) - /* Use an alias to avoid warning, as pthread_exit is declared noreturn. */ FORWARD_NORETURN (__pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS)) diff --git a/htl/pt-initialize.c b/htl/pt-initialize.c index cf312f1cd6..40eeb7e776 100644 --- a/htl/pt-initialize.c +++ b/htl/pt-initialize.c @@ -27,8 +27,6 @@ #if IS_IN (libpthread) static const struct pthread_functions pthread_functions = { - .ptr_pthread_cond_wait = __pthread_cond_wait, - .ptr_pthread_cond_timedwait = __pthread_cond_timedwait, .ptr___pthread_exit = __pthread_exit, .ptr_pthread_mutex_destroy = __pthread_mutex_destroy, .ptr_pthread_mutex_init = __pthread_mutex_init, diff --git a/sysdeps/htl/pt-cond-timedwait.c b/sysdeps/htl/pt-cond-timedwait.c index 78853da89b..dc256b8f74 100644 --- a/sysdeps/htl/pt-cond-timedwait.c +++ b/sysdeps/htl/pt-cond-timedwait.c @@ -17,7 +17,7 @@ . */ #include - +#include #include #include #include @@ -34,8 +34,12 @@ __pthread_cond_timedwait (pthread_cond_t *cond, { return __pthread_cond_timedwait_internal (cond, mutex, -1, abstime); } +libc_hidden_def (__pthread_cond_timedwait) +versioned_symbol (libc, __pthread_cond_timedwait, pthread_cond_timedwait, GLIBC_2_21); -weak_alias (__pthread_cond_timedwait, pthread_cond_timedwait); +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_21) +compat_symbol (libc, __pthread_cond_timedwait, pthread_cond_timedwait, GLIBC_2_12); +#endif int __pthread_cond_clockwait (pthread_cond_t *cond, @@ -45,8 +49,8 @@ __pthread_cond_clockwait (pthread_cond_t *cond, { return __pthread_cond_timedwait_internal (cond, mutex, clockid, abstime); } - weak_alias (__pthread_cond_clockwait, pthread_cond_clockwait); +libc_hidden_def (__pthread_cond_clockwait) struct cancel_ctx { diff --git a/sysdeps/htl/pt-cond-wait.c b/sysdeps/htl/pt-cond-wait.c index d00547f3a5..850afba1ad 100644 --- a/sysdeps/htl/pt-cond-wait.c +++ b/sysdeps/htl/pt-cond-wait.c @@ -17,7 +17,7 @@ . */ #include - +#include #include /* Implemented in pt-cond-timedwait.c. */ @@ -35,5 +35,9 @@ __pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex) { return __pthread_cond_timedwait_internal (cond, mutex, -1, 0); } +libc_hidden_def (__pthread_cond_wait) +versioned_symbol (libc, __pthread_cond_wait, pthread_cond_wait, GLIBC_2_21); -weak_alias (__pthread_cond_wait, pthread_cond_wait); +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_21) +compat_symbol (libc, __pthread_cond_wait, pthread_cond_wait, GLIBC_2_12); +#endif diff --git a/sysdeps/htl/pthread-functions.h b/sysdeps/htl/pthread-functions.h index fafefa5a4c..ff93c22a65 100644 --- a/sysdeps/htl/pthread-functions.h +++ b/sysdeps/htl/pthread-functions.h @@ -21,9 +21,6 @@ #include -int __pthread_cond_wait (pthread_cond_t *, pthread_mutex_t *); -int __pthread_cond_timedwait (pthread_cond_t *, pthread_mutex_t *, - const struct timespec *); void __pthread_exit (void *) __attribute__ ((__noreturn__)); int _pthread_mutex_destroy (pthread_mutex_t *); int _pthread_mutex_init (pthread_mutex_t *, @@ -51,9 +48,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_wait) (pthread_cond_t *, pthread_mutex_t *); - int (*ptr_pthread_cond_timedwait) (pthread_cond_t *, pthread_mutex_t *, - const struct timespec *); void (*ptr___pthread_exit) (void *) __attribute__ ((__noreturn__)); int (*ptr_pthread_mutex_destroy) (pthread_mutex_t *); int (*ptr_pthread_mutex_init) (pthread_mutex_t *, diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h index 3c9f38c734..b5a9f0cba4 100644 --- a/sysdeps/htl/pthreadP.h +++ b/sysdeps/htl/pthreadP.h @@ -49,14 +49,17 @@ libc_hidden_proto (__pthread_cond_signal); 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); +libc_hidden_proto (__pthread_cond_wait); extern int __pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime); +libc_hidden_proto (__pthread_cond_timedwait); extern int __pthread_cond_clockwait (pthread_cond_t *cond, pthread_mutex_t *mutex, clockid_t clockid, const struct timespec *abstime) __nonnull ((1, 2, 4)); +libc_hidden_proto (__pthread_cond_clockwait); extern int __pthread_cond_destroy (pthread_cond_t *cond); libc_hidden_proto (__pthread_cond_destroy); extern int __pthread_sigmask (int, const sigset_t *, sigset_t *); diff --git a/sysdeps/htl/timer_routines.c b/sysdeps/htl/timer_routines.c index 1244ce868a..4117545bac 100644 --- a/sysdeps/htl/timer_routines.c +++ b/sysdeps/htl/timer_routines.c @@ -418,10 +418,10 @@ thread_func (void *arg) head of the queue must wake up the thread by broadcasting this condition variable. */ if (timer != NULL) - pthread_cond_timedwait (&self->cond, &__timer_mutex, + __pthread_cond_timedwait (&self->cond, &__timer_mutex, &timer->expirytime); else - pthread_cond_wait (&self->cond, &__timer_mutex); + __pthread_cond_wait (&self->cond, &__timer_mutex); } /* This macro will never be executed since the while loop loops forever - but we have to add it for proper nesting. */ diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist index e2f18b8172..b48fa38edf 100644 --- a/sysdeps/mach/hurd/i386/libc.abilist +++ b/sysdeps/mach/hurd/i386/libc.abilist @@ -53,6 +53,8 @@ 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 GLIBC_2.12 pthread_condattr_destroy F GLIBC_2.12 pthread_condattr_getclock F GLIBC_2.12 pthread_condattr_getpshared F @@ -2250,6 +2252,7 @@ GLIBC_2.30 twalk_r F GLIBC_2.32 __libc_single_threaded D 0x1 GLIBC_2.32 mach_print F GLIBC_2.32 mremap F +GLIBC_2.32 pthread_cond_clockwait 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 7c61af5fa1..f90794bc5c 100644 --- a/sysdeps/mach/hurd/i386/libpthread.abilist +++ b/sysdeps/mach/hurd/i386/libpthread.abilist @@ -30,8 +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_timedwait F -GLIBC_2.12 pthread_cond_wait F GLIBC_2.12 pthread_create F GLIBC_2.12 pthread_detach F GLIBC_2.12 pthread_exit F @@ -119,7 +117,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_cond_clockwait F GLIBC_2.32 pthread_mutex_clocklock F GLIBC_2.32 pthread_mutex_consistent F GLIBC_2.32 pthread_mutex_consistent_np F diff --git a/sysdeps/mach/hurd/x86_64/libc.abilist b/sysdeps/mach/hurd/x86_64/libc.abilist index b331c26eff..1cd5f99297 100644 --- a/sysdeps/mach/hurd/x86_64/libc.abilist +++ b/sysdeps/mach/hurd/x86_64/libc.abilist @@ -1532,6 +1532,7 @@ GLIBC_2.38 pthread_attr_setstack F GLIBC_2.38 pthread_attr_setstackaddr F GLIBC_2.38 pthread_attr_setstacksize 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 diff --git a/sysdeps/mach/hurd/x86_64/libpthread.abilist b/sysdeps/mach/hurd/x86_64/libpthread.abilist index 5b2da07745..6262dfa86c 100644 --- a/sysdeps/mach/hurd/x86_64/libpthread.abilist +++ b/sysdeps/mach/hurd/x86_64/libpthread.abilist @@ -48,9 +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_clockwait F -GLIBC_2.38 pthread_cond_timedwait F -GLIBC_2.38 pthread_cond_wait F GLIBC_2.38 pthread_create F GLIBC_2.38 pthread_detach F GLIBC_2.38 pthread_exit F