diff mbox series

[09/35] nptl: Add internal macro definition of pthread_self

Message ID 55251be04deb2a13ba73c18a6c1e4789cb7fe3f3.1622761828.git.fweimer@redhat.com
State New
Headers show
Series Linux: Move librt into libc | expand

Commit Message

Florian Weimer June 3, 2021, 11:15 p.m. UTC
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 mbox series


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 <tls.h>
-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)