about summary refs log tree commit diff
path: root/nptl
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
commit43fe356d18e12b5826dfee4c0b57b5c75c3a9a72 (patch)
tree70aff7217ebdc746c77f3f5b2a18a3e7ae051579 /nptl
parent130fca173f323a24b41873b6656ab77c7cff86e1 (diff)
downloadglibc-43fe356d18e12b5826dfee4c0b57b5c75c3a9a72.tar.gz
glibc-43fe356d18e12b5826dfee4c0b57b5c75c3a9a72.tar.xz
glibc-43fe356d18e12b5826dfee4c0b57b5c75c3a9a72.zip
nptl: Move internal __nptl_nthreads variable into libc
Reviewed-by: Adhemerval Zanella   <adhemerval.zanella@linaro.org>
Diffstat (limited to 'nptl')
-rw-r--r--nptl/Makefile1
-rw-r--r--nptl/Versions1
-rw-r--r--nptl/nptl-init.c1
-rw-r--r--nptl/nptl_nthreads.c23
-rw-r--r--nptl/pthreadP.h3
-rw-r--r--nptl/pthread_create.c4
6 files changed, 27 insertions, 6 deletions
diff --git a/nptl/Makefile b/nptl/Makefile
index 1d3781062c..dce54d02df 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -45,6 +45,7 @@ routines = \
   libc_multiple_threads \
   libc_pthread_init \
   lowlevellock \
+  nptl_nthreads \
   old_pthread_cond_destroy \
   old_pthread_cond_init \
   pthread_atfork \
diff --git a/nptl/Versions b/nptl/Versions
index 193376c827..b4ee1bf309 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -106,6 +106,7 @@ libc {
     __lll_lock_wait_private;
     __lll_trylock_elision;
     __lll_unlock_elision;
+    __nptl_nthreads;
     __pthread_attr_copy;
     __pthread_attr_destroy;
     __pthread_attr_init;
diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index 124799679b..aad4f21f74 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -93,7 +93,6 @@ static const struct pthread_functions pthread_functions =
     .ptr___pthread_key_create = __pthread_key_create,
     .ptr___pthread_getspecific = __pthread_getspecific,
     .ptr___pthread_setspecific = __pthread_setspecific,
-    .ptr_nthreads = &__nptl_nthreads,
     .ptr__nptl_deallocate_tsd = __nptl_deallocate_tsd,
     .ptr__nptl_setxid = __nptl_setxid,
     .ptr_set_robust = __nptl_set_robust
diff --git a/nptl/nptl_nthreads.c b/nptl/nptl_nthreads.c
new file mode 100644
index 0000000000..2245bb3c76
--- /dev/null
+++ b/nptl/nptl_nthreads.c
@@ -0,0 +1,23 @@
+/* Thread counter variable.
+   Copyright (C) 2021 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <pthreadP.h>
+
+/* Number of threads running.  */
+unsigned int __nptl_nthreads = 1;
+libc_hidden_data_def (__nptl_nthreads)
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index 2e66379441..64ec71c23f 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -220,7 +220,8 @@ extern struct pthread_key_struct __pthread_keys[PTHREAD_KEYS_MAX];
 hidden_proto (__pthread_keys)
 
 /* Number of threads running.  */
-extern unsigned int __nptl_nthreads attribute_hidden;
+extern unsigned int __nptl_nthreads;
+libc_hidden_proto (__nptl_nthreads)
 
 #ifndef __ASSUME_SET_ROBUST_LIST
 /* Negative if we do not have the system call and we can use it.  */
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index f13d8e44a4..c1c5b241c8 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -59,10 +59,6 @@ static struct rtld_global *__nptl_rtld_global __attribute_used__
   = &_rtld_global;
 #endif
 
-/* Number of threads running.  */
-unsigned int __nptl_nthreads = 1;
-
-
 /* Code to allocate and deallocate a stack.  */
 #include "allocatestack.c"