about summary refs log tree commit diff
path: root/nptl/pthread_once.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-04-21 19:49:50 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-04-21 19:49:50 +0200
commit3fec7f18bfcb7044e813a12e19c3c98eb8387e26 (patch)
tree63320bd00d52f0437c4f8676fbff561311dfdb8f /nptl/pthread_once.c
parent4647ce82c733d1453611e35236b786ecd7faf598 (diff)
downloadglibc-3fec7f18bfcb7044e813a12e19c3c98eb8387e26.tar.gz
glibc-3fec7f18bfcb7044e813a12e19c3c98eb8387e26.tar.xz
glibc-3fec7f18bfcb7044e813a12e19c3c98eb8387e26.zip
nptl: Move pthread_once and __pthread_once into libc
And also the fork generation counter, __fork_generation.  This
eliminates the need for __fork_generation_pointer.

call_once remains in libpthread and calls the exported __pthread_once
symbol.

pthread_once and __pthread_once have been moved using
scripts/move-symbol-to-libc.py.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'nptl/pthread_once.c')
-rw-r--r--nptl/pthread_once.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/nptl/pthread_once.c b/nptl/pthread_once.c
index 7645da222a..323583c118 100644
--- a/nptl/pthread_once.c
+++ b/nptl/pthread_once.c
@@ -19,7 +19,8 @@
 #include "pthreadP.h"
 #include <futex-internal.h>
 #include <atomic.h>
-
+#include <libc-lockP.h>
+#include <shlib-compat.h>
 
 unsigned long int __fork_generation attribute_hidden;
 
@@ -132,7 +133,7 @@ __pthread_once_slow (pthread_once_t *once_control, void (*init_routine) (void))
 }
 
 int
-__pthread_once (pthread_once_t *once_control, void (*init_routine) (void))
+___pthread_once (pthread_once_t *once_control, void (*init_routine) (void))
 {
   /* Fast path.  See __pthread_once_slow.  */
   int val;
@@ -142,5 +143,11 @@ __pthread_once (pthread_once_t *once_control, void (*init_routine) (void))
   else
     return __pthread_once_slow (once_control, init_routine);
 }
-weak_alias (__pthread_once, pthread_once)
-hidden_def (__pthread_once)
+versioned_symbol (libc, ___pthread_once, __pthread_once, GLIBC_2_34);
+libc_hidden_ver (___pthread_once, __pthread_once)
+
+versioned_symbol (libc, ___pthread_once, pthread_once, GLIBC_2_34);
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_34)
+compat_symbol (libpthread, ___pthread_once, __pthread_once, GLIBC_2_0);
+compat_symbol (libpthread, ___pthread_once, pthread_once, GLIBC_2_0);
+#endif