From patchwork Thu Jun 3 23:15:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 43689 X-Patchwork-Delegate: azanella@linux.vnet.ibm.com 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 9E4483990433 for ; Thu, 3 Jun 2021 23:22:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9E4483990433 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1622762522; bh=Jv7lCva/DTjEgJNs3NoahGaaraBjkG+te9hObR799g0=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=e+0do8XE84rNcrAiLwqF+yQOaW/P21NrFlH6/ph0T1vYIvJsCQAYBhe2yPGjmZxgZ K8BHyy/mfBFjr1wVhx5YDrlcRhDJKFzVazP8LEI13LrDhqD/Oprv8GxmYTM0GZSxBX IjlEDJ5ZDu9T2hCvxWM8O6ZsVpgPRVLrHMzVtHAU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 338203990420 for ; Thu, 3 Jun 2021 23:15:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 338203990420 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-489-k4jOyOm2Pb2dFDRjIzKIqA-1; Thu, 03 Jun 2021 19:15:37 -0400 X-MC-Unique: k4jOyOm2Pb2dFDRjIzKIqA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 92A71180FD78 for ; Thu, 3 Jun 2021 23:15:36 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-113-228.ams2.redhat.com [10.36.113.228]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EBE0B60C17 for ; Thu, 3 Jun 2021 23:15:35 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH 09/35] nptl: Add internal macro definition of pthread_self In-Reply-To: References: X-From-Line: 55251be04deb2a13ba73c18a6c1e4789cb7fe3f3 Mon Sep 17 00:00:00 2001 Message-Id: <55251be04deb2a13ba73c18a6c1e4789cb7fe3f3.1622761828.git.fweimer@redhat.com> Date: Fri, 04 Jun 2021 01:15:33 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" The old __pthread_self hidden prototype did not work because there was no implementation. (Hurd uses __pthread_self as a variable, so it's prudent to avoid this identifier on Linux.) A macro is needed so that nptl/pthread_self.c can still be built (static inline would prevent that) and __extern_inline does not work due to the definition of THREAD_SELF on hppa. --- nptl/pthread_self.c | 2 +- sysdeps/nptl/pthreadP.h | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/nptl/pthread_self.c b/nptl/pthread_self.c index f877a2e6bd..c0d136be41 100644 --- a/nptl/pthread_self.c +++ b/nptl/pthread_self.c @@ -20,7 +20,7 @@ #include pthread_t -pthread_self (void) +(pthread_self) (void) { return (pthread_t) THREAD_SELF; } diff --git a/sysdeps/nptl/pthreadP.h b/sysdeps/nptl/pthreadP.h index 5c2fd64d58..f4a5f70f60 100644 --- a/sysdeps/nptl/pthreadP.h +++ b/sysdeps/nptl/pthreadP.h @@ -520,7 +520,6 @@ extern int __pthread_once (pthread_once_t *once_control, libc_hidden_proto (__pthread_once) extern int __pthread_atfork (void (*prepare) (void), void (*parent) (void), void (*child) (void)); -extern pthread_t __pthread_self (void); extern int __pthread_equal (pthread_t thread1, pthread_t thread2); extern int __pthread_detach (pthread_t th); libc_hidden_proto (__pthread_detach) @@ -698,6 +697,10 @@ int __pthread_attr_extension (struct pthread_attr *attr) attribute_hidden int __pthread_attr_copy (pthread_attr_t *target, const pthread_attr_t *source); libc_hidden_proto (__pthread_attr_copy) +/* This cannot be an inline function because a static inline conflict + on hppa. */ +#define pthread_self() ((pthread_t) THREAD_SELF) + /* Returns 0 if POL is a valid scheduling policy. */ static inline int check_sched_policy_attr (int pol)