From patchwork Tue Nov 19 19:22:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gfleury X-Patchwork-Id: 101551 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 C393E385840C for ; Tue, 19 Nov 2024 19:23:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C393E385840C Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=disroot.org header.i=@disroot.org header.a=rsa-sha256 header.s=mail header.b=kNirDB/z X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from layka.disroot.org (layka.disroot.org [178.21.23.139]) by sourceware.org (Postfix) with ESMTPS id 0337F3858D34 for ; Tue, 19 Nov 2024 19:23:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0337F3858D34 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=disroot.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=disroot.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0337F3858D34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=178.21.23.139 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1732044183; cv=none; b=GCuDhD7Z1O3PVrTg83z9N3qJCKO8LlbappokxHixpIyShEBGkuqAtlbqXt/VS5Q4+4lqrcospGV/UoDA5ZPknZB9bVHQI5eougiLZXRG5QIhoGCsNDb/OAD0fBS8bXCbh3pod6BxDr6cJxBkE6T97rTGNalaZmpZfN3txz8neqU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1732044183; c=relaxed/simple; bh=rnbmrhXjgcktayTHuV+RqO4lDpTnfbe+7d1iPLoVt3U=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=Bh+re/ojTJt0YbR1K/fAzsnj3gFjumuV3T+amjfrdgX7oXiTgfHpIOY4qNB0T1HC/+EBIOsP72A11xCrPS23hxDikrAfg56pbNppfFTDHNc1WXulvkm3OqlrAFV2CftyqAt2bbMl53+luD6R52CsMqQTaJYEvfAMzyijgJWVyKs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0337F3858D34 Received: from mail01.disroot.lan (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 8E43B24EFC; Tue, 19 Nov 2024 20:23:01 +0100 (CET) X-Virus-Scanned: SPAM Filter at disroot.org Received: from layka.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id fLjdfWnT8P2D; Tue, 19 Nov 2024 20:23:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1732044180; bh=rnbmrhXjgcktayTHuV+RqO4lDpTnfbe+7d1iPLoVt3U=; h=From:To:Cc:Subject:Date; b=kNirDB/zsWxYmmhHfWlVMS9/v1bkyCV7mFpvERZ9JQ+4pGUgQOj/VwZTE7FztaWLe U9DnAevbAotrf91AquXFuJvZgq2gORJJWtBHD9nk766NKuz0m+F9zSmguZdv5uzhAG NL9B4eB+oyDEJxEqXbTXPOjgqIp9lqsGDIEHdO1PBVT6xLYQ4Bxr+FOcUfMQ651NMv rxmNSF8HwwuVaRgVsQM3jdlhO+GZcQhTSbMx7ejOKySmRIlUqNRh2Mfmy2tYg/NYjk kagYkQ1Vwl1T4Fy2NZwoOjqGIffwfmcm+P44aGb3HQx6QseP3laFDvAMWEv1dYyey/ yuNojaMot4rBg== From: gfleury To: libc-alpha@sourceware.org Cc: gfleury Subject: [PATCH] htl: move pthread_setcancelstate into libc. Date: Tue, 19 Nov 2024 21:22:38 +0200 Message-Id: <20241119192238.500767-1-gfleury@disroot.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, 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 --- htl/Makefile | 2 +- htl/Versions | 4 +++- htl/forward.c | 4 ---- htl/pt-initialize.c | 1 - htl/pt-setcancelstate.c | 8 ++++++-- sysdeps/htl/libc-lockP.h | 5 ++--- sysdeps/htl/pthread-functions.h | 2 -- sysdeps/htl/pthreadP.h | 3 --- 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(+), 19 deletions(-) diff --git a/htl/Makefile b/htl/Makefile index 25eb7910..3ebb76c2 100644 --- a/htl/Makefile +++ b/htl/Makefile @@ -51,7 +51,6 @@ libpthread-routines := \ pt-sigmask \ pt-spin-inlines \ pt-cleanup \ - pt-setcancelstate \ pt-setcanceltype \ pt-testcancel \ pt-cancel \ @@ -210,6 +209,7 @@ routines := \ pt-nthreads \ pt-pthread_self \ pt-self pt-equal \ + pt-setcancelstate \ pt-setschedparam \ # routines shared-only-routines = forward diff --git a/htl/Versions b/htl/Versions index afc2495e..ffe79fcb 100644 --- a/htl/Versions +++ b/htl/Versions @@ -26,6 +26,7 @@ libc { pthread_attr_setscope; pthread_attr_setschedparam; pthread_attr_init; + pthread_setcancelstate; } GLIBC_2.21 { @@ -82,6 +83,7 @@ libc { __pthread_attr_setstacksize; __pthread_attr_setstackaddr; __pthread_attr_setstack; + __pthread_setcancelstate; } } @@ -159,7 +161,7 @@ libpthread { pthread_rwlockattr_destroy; pthread_rwlockattr_getpshared; pthread_rwlockattr_init; pthread_rwlockattr_setpshared; - pthread_setcancelstate; pthread_setcanceltype; + pthread_setcanceltype; pthread_setconcurrency; pthread_setschedprio; pthread_setspecific; diff --git a/htl/forward.c b/htl/forward.c index 7c0e16dc..860d9f69 100644 --- a/htl/forward.c +++ b/htl/forward.c @@ -84,10 +84,6 @@ FORWARD (pthread_mutex_lock, (pthread_mutex_t *mutex), (mutex), 0) FORWARD (pthread_mutex_unlock, (pthread_mutex_t *mutex), (mutex), 0) -FORWARD (__pthread_setcancelstate, (int state, int *oldstate), - (state, oldstate), 0) -strong_alias (__pthread_setcancelstate, pthread_setcancelstate); - FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0) FORWARD2 (__pthread_get_cleanup_stack, struct __pthread_cancelation_handler **, diff --git a/htl/pt-initialize.c b/htl/pt-initialize.c index b082a13b..07435171 100644 --- a/htl/pt-initialize.c +++ b/htl/pt-initialize.c @@ -41,7 +41,6 @@ static const struct pthread_functions pthread_functions = { .ptr_pthread_mutex_lock = __pthread_mutex_lock, .ptr_pthread_mutex_trylock = __pthread_mutex_trylock, .ptr_pthread_mutex_unlock = __pthread_mutex_unlock, - .ptr___pthread_setcancelstate = __pthread_setcancelstate, .ptr_pthread_setcanceltype = __pthread_setcanceltype, .ptr___pthread_get_cleanup_stack = __pthread_get_cleanup_stack, .ptr_pthread_once = __pthread_once, diff --git a/htl/pt-setcancelstate.c b/htl/pt-setcancelstate.c index b427a74e..4c812aef 100644 --- a/htl/pt-setcancelstate.c +++ b/htl/pt-setcancelstate.c @@ -17,7 +17,7 @@ . */ #include - +#include #include int @@ -42,5 +42,9 @@ __pthread_setcancelstate (int state, int *oldstate) return 0; } +libc_hidden_def (__pthread_setcancelstate) +versioned_symbol (libc, __pthread_setcancelstate, pthread_setcancelstate, GLIBC_2_21); -weak_alias (__pthread_setcancelstate, pthread_setcancelstate); +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_21) +compat_symbol (libc, __pthread_setcancelstate, pthread_setcancelstate, GLIBC_2_12); +#endif diff --git a/sysdeps/htl/libc-lockP.h b/sysdeps/htl/libc-lockP.h index fbb3e14f..3840d4ae 100644 --- a/sysdeps/htl/libc-lockP.h +++ b/sysdeps/htl/libc-lockP.h @@ -113,7 +113,8 @@ extern int __pthread_atfork (void (*__prepare) (void), void (*__parent) (void), void (*__child) (void)); - +extern int __pthread_setcancelstate (int state, int *oldstate); +libc_hidden_proto (__pthread_setcancelstate) /* Make the pthread functions weak so that we can elide them from single-threaded processes. */ @@ -140,7 +141,6 @@ weak_extern (__pthread_getspecific) weak_extern (__pthread_once) weak_extern (__pthread_initialize) weak_extern (__pthread_atfork) -weak_extern (__pthread_setcancelstate) # else # pragma weak __pthread_mutex_init # pragma weak __pthread_mutex_destroy @@ -162,7 +162,6 @@ weak_extern (__pthread_setcancelstate) # pragma weak __pthread_once # pragma weak __pthread_initialize # pragma weak __pthread_atfork -# pragma weak __pthread_setcancelstate # endif #endif diff --git a/sysdeps/htl/pthread-functions.h b/sysdeps/htl/pthread-functions.h index d380d17b..4596e92d 100644 --- a/sysdeps/htl/pthread-functions.h +++ b/sysdeps/htl/pthread-functions.h @@ -38,7 +38,6 @@ int _pthread_mutex_init (pthread_mutex_t *, int __pthread_mutex_lock (pthread_mutex_t *); int __pthread_mutex_trylock (pthread_mutex_t *); int __pthread_mutex_unlock (pthread_mutex_t *); -int __pthread_setcancelstate (int, int *); int __pthread_setcanceltype (int, int *); struct __pthread_cancelation_handler **__pthread_get_cleanup_stack (void); int __pthread_once (pthread_once_t *, void (*) (void)); @@ -75,7 +74,6 @@ struct pthread_functions int (*ptr_pthread_mutex_lock) (pthread_mutex_t *); int (*ptr_pthread_mutex_trylock) (pthread_mutex_t *); int (*ptr_pthread_mutex_unlock) (pthread_mutex_t *); - int (*ptr___pthread_setcancelstate) (int, int *); int (*ptr_pthread_setcanceltype) (int, int *); struct __pthread_cancelation_handler **(*ptr___pthread_get_cleanup_stack) (void); int (*ptr_pthread_once) (pthread_once_t *, void (*) (void)); diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h index 68e6cf17..70ef9664 100644 --- a/sysdeps/htl/pthreadP.h +++ b/sysdeps/htl/pthreadP.h @@ -77,9 +77,6 @@ void *__pthread_getspecific (pthread_key_t key); int __pthread_setspecific (pthread_key_t key, const void *value); int __pthread_key_delete (pthread_key_t key); int __pthread_once (pthread_once_t *once_control, void (*init_routine) (void)); - -int __pthread_setcancelstate (int state, int *oldstate); - int __pthread_getattr_np (pthread_t, pthread_attr_t *); int __pthread_attr_getstackaddr (const pthread_attr_t *__restrict __attr, void **__restrict __stackaddr); diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist index 101d5b80..ab677b31 100644 --- a/sysdeps/mach/hurd/i386/libc.abilist +++ b/sysdeps/mach/hurd/i386/libc.abilist @@ -52,6 +52,7 @@ GLIBC_2.12 pthread_attr_setstacksize F GLIBC_2.12 pthread_equal F GLIBC_2.12 pthread_getschedparam F GLIBC_2.12 pthread_self F +GLIBC_2.12 pthread_setcancelstate F GLIBC_2.12 pthread_setschedparam F GLIBC_2.13 __fentry__ F GLIBC_2.14 syncfs F diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist index 4e287c2e..0dc37f66 100644 --- a/sysdeps/mach/hurd/i386/libpthread.abilist +++ b/sysdeps/mach/hurd/i386/libpthread.abilist @@ -86,7 +86,6 @@ GLIBC_2.12 pthread_rwlockattr_destroy F GLIBC_2.12 pthread_rwlockattr_getpshared F GLIBC_2.12 pthread_rwlockattr_init F GLIBC_2.12 pthread_rwlockattr_setpshared F -GLIBC_2.12 pthread_setcancelstate F GLIBC_2.12 pthread_setcanceltype F GLIBC_2.12 pthread_setconcurrency F GLIBC_2.12 pthread_setschedprio F diff --git a/sysdeps/mach/hurd/x86_64/libpthread.abilist b/sysdeps/mach/hurd/x86_64/libpthread.abilist index 3396ea9e..26c735c4 100644 --- a/sysdeps/mach/hurd/x86_64/libpthread.abilist +++ b/sysdeps/mach/hurd/x86_64/libpthread.abilist @@ -116,7 +116,6 @@ GLIBC_2.38 pthread_rwlockattr_destroy F GLIBC_2.38 pthread_rwlockattr_getpshared F GLIBC_2.38 pthread_rwlockattr_init F GLIBC_2.38 pthread_rwlockattr_setpshared F -GLIBC_2.38 pthread_setcancelstate F GLIBC_2.38 pthread_setcanceltype F GLIBC_2.38 pthread_setconcurrency F GLIBC_2.38 pthread_setschedprio F