From patchwork Sat Aug 16 00:13:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 118436 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 9D0A13858405 for ; Sat, 16 Aug 2025 00:15:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9D0A13858405 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 C80A73858C2F for ; Sat, 16 Aug 2025 00:14:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C80A73858C2F 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 C80A73858C2F 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=1755303248; cv=none; b=t17LboZxQ8RBRW4cZfAjf0Jp7iGgjIbD2bcnKABFpV4BKCjPYFoEW1YdxfDmq8a4m4uKyQ3zWQGoVd8UEVtZzEZ4IKsQlCOqeigL//iEBzJB7tb8x9nTNKbtF2RY2lK1jf9MscBoG5xbmbG6BtNy5G2jM9MHi38gRLxAmHrGyBM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1755303248; c=relaxed/simple; bh=nZfqAYzNwh3AAMuftKrkQbWEYJ9ep2nm18VTTLbg984=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=TBr/S2wRB4TqbCoSlHVhLNzDdFVVjPKvEeXChpFeomdyQuAjJHvz1VR3L3V4Od5fjZOGgaNCWgSxCmFJCLGnZSg5t4NIn6/nI6WgKebJHMB8BMkrQIwimljysQUN0O9sVdr6kALrl7vIj6Elq6DQAvHBhJZqZk4Mc5xEXOvC21o= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C80A73858C2F Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 9671DA5DFB; Sat, 16 Aug 2025 02:14:07 +0200 (CEST) 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 YJezWjRahEFd; Sat, 16 Aug 2025 02:14:07 +0200 (CEST) Received: from begin (165.21.205.77.rev.sfr.net [77.205.21.165]) (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 367D2A49AF; Sat, 16 Aug 2025 02:14:07 +0200 (CEST) Received: from samy by begin with local (Exim 4.98.2) (envelope-from ) id 1un4Yg-00000000Wwk-0DpQ; Sat, 16 Aug 2025 02:14:06 +0200 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: gfleury , commit-hurd@gnu.org Subject: [hurd, commited 03/19] htl: move __pthread_init_{specific, static_tls}, __pthread_{alloc}, dealloc} into libc. Date: Sat, 16 Aug 2025 02:13:49 +0200 Message-ID: <20250816001405.126154-4-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250816001405.126154-1-samuel.thibault@ens-lyon.org> References: <20250816001405.126154-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, 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: <20250815181500.107433-4-gfleury@disroot.org> --- htl/Makefile | 6 +++--- htl/Versions | 5 +++++ htl/pt-alloc.c | 4 ++++ htl/pt-dealloc.c | 3 +++ htl/pt-internal.h | 5 ++++- sysdeps/htl/pt-init-specific.c | 2 ++ sysdeps/htl/pthreadP.h | 3 ++- 7 files changed, 23 insertions(+), 5 deletions(-) diff --git a/htl/Makefile b/htl/Makefile index f33c1dccf2..1b2b501fef 100644 --- a/htl/Makefile +++ b/htl/Makefile @@ -25,11 +25,8 @@ SYSDEPS := lockfile LCLHDRS := libpthread-routines := \ - pt-init-specific \ - pt-alloc \ pt-create \ pt-getattr \ - pt-dealloc \ pt-detach \ pt-exit \ pt-initialize \ @@ -108,6 +105,7 @@ routines := \ forward \ htlfreeres \ libc_pthread_init \ + pt-alloc \ pt-attr \ pt-attr-destroy \ pt-attr-getdetachstate \ @@ -153,10 +151,12 @@ routines := \ pt-condattr-init \ pt-condattr-setclock \ pt-condattr-setpshared \ + pt-dealloc \ pt-destroy-specific \ pt-getconcurrency \ pt-getschedparam \ pt-getspecific \ + pt-init-specific \ pt-key-create \ pt-key-delete \ pt-mutex-checklocked \ diff --git a/htl/Versions b/htl/Versions index ad3628eb3c..851a2a5398 100644 --- a/htl/Versions +++ b/htl/Versions @@ -201,9 +201,11 @@ libc { __pthread_cleanup_stack; __pthread_total; ___pthread_self; + __pthread_alloc; __pthread_block; __pthread_block_intr; __pthread_init_thread; + __pthread_init_static_tls; __pthread_default_attr; __pthread_attr_init; __pthread_attr_getstacksize; @@ -212,6 +214,8 @@ libc { __pthread_attr_setstacksize; __pthread_attr_setstackaddr; __pthread_attr_setstack; + __pthread_dealloc; + __pthread_dealloc_finish; __pthread_setcancelstate; __pthread_cond_broadcast; __pthread_cond_destroy; @@ -225,6 +229,7 @@ libc { __pthread_destroy_specific; __pthread_getspecific; __pthread_key_delete; + __pthread_max_threads; __pthread_mutex_checklocked; __pthread_mutex_destroy; __pthread_mutex_init; diff --git a/htl/pt-alloc.c b/htl/pt-alloc.c index c0074b4447..4b44e98e5b 100644 --- a/htl/pt-alloc.c +++ b/htl/pt-alloc.c @@ -23,6 +23,7 @@ #include #include +#include /* This braindamage is necessary because the standard says that some of the threads functions "shall fail" if "No thread could be found @@ -30,6 +31,7 @@ /* The size of the thread ID lookup table. */ int __pthread_max_threads; +libc_hidden_data_def (__pthread_max_threads) /* List of thread structures corresponding to free thread IDs. */ struct __pthread *__pthread_free_threads; @@ -201,6 +203,7 @@ retry: *pthread = new; return 0; } +libc_hidden_def (__pthread_alloc) void attribute_hidden @@ -230,3 +233,4 @@ __pthread_init_static_tls (struct link_map *map) } __libc_rwlock_unlock (GL (dl_pthread_threads_lock)); } +libc_hidden_def (__pthread_init_static_tls) diff --git a/htl/pt-dealloc.c b/htl/pt-dealloc.c index 13417df42f..7a90302b02 100644 --- a/htl/pt-dealloc.c +++ b/htl/pt-dealloc.c @@ -23,6 +23,7 @@ #include #include +#include /* List of thread structures corresponding to free thread IDs. */ extern struct __pthread *__pthread_free_threads; @@ -55,6 +56,7 @@ __pthread_dealloc (struct __pthread *pthread) __pthread_enqueue (&__pthread_free_threads, pthread); __pthread_mutex_unlock (&__pthread_free_threads_lock); } +libc_hidden_def (__pthread_dealloc) /* Confirm deallocation of the thread structure for PTHREAD. */ void @@ -69,3 +71,4 @@ __pthread_dealloc_finish (struct __pthread *pthread) which reads this variable. */ pthread->terminated = TRUE; } +libc_hidden_def (__pthread_dealloc_finish) diff --git a/htl/pt-internal.h b/htl/pt-internal.h index 8b37838b8e..54385630b1 100644 --- a/htl/pt-internal.h +++ b/htl/pt-internal.h @@ -172,6 +172,7 @@ extern int __pthread_concurrency; /* The size of the thread ID lookup table. */ extern int __pthread_max_threads; +libc_hidden_proto (__pthread_max_threads) #define __pthread_getid(thread) \ ({ struct __pthread *__t = NULL; \ @@ -209,6 +210,7 @@ extern int __pthread_create_internal (struct __pthread **__restrict pthread, /* Allocate a new thread structure and a pthread thread ID (but not a kernel thread or a stack). THREAD has one reference. */ extern int __pthread_alloc (struct __pthread **thread); +libc_hidden_proto (__pthread_alloc) /* Deallocate the content of the thread structure. This is the dual of __pthread_alloc (N.B. it does not call __pthread_stack_dealloc nor @@ -217,11 +219,12 @@ extern int __pthread_alloc (struct __pthread **thread); to call __pthread_dealloc_finish when it is really finished with using THREAD. */ extern void __pthread_dealloc (struct __pthread *thread); +libc_hidden_proto (__pthread_dealloc) /* Confirm deallocating the thread structure. Before calling this the structure will not be reused yet. */ extern void __pthread_dealloc_finish (struct __pthread *pthread); - +libc_hidden_proto (__pthread_dealloc_finish) /* Allocate a stack of size STACKSIZE. The stack base shall be returned in *STACKADDR. */ diff --git a/sysdeps/htl/pt-init-specific.c b/sysdeps/htl/pt-init-specific.c index f740b120a1..56a49d617c 100644 --- a/sysdeps/htl/pt-init-specific.c +++ b/sysdeps/htl/pt-init-specific.c @@ -20,6 +20,8 @@ #include #include +#include + error_t __pthread_init_specific (struct __pthread *thread) diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h index 5dea8bd172..1538fdee72 100644 --- a/sysdeps/htl/pthreadP.h +++ b/sysdeps/htl/pthreadP.h @@ -28,7 +28,8 @@ /* Attribute to indicate thread creation was issued from C11 thrd_create. */ #define ATTR_C11_THREAD ((void*)(uintptr_t)-1) -extern void __pthread_init_static_tls (struct link_map *) attribute_hidden; +extern void __pthread_init_static_tls (struct link_map *); +libc_hidden_proto (__pthread_init_static_tls) /* These represent the interface used by glibc itself. */