events \
futex-internal \
libc-cleanup \
- libc_multiple_threads \
lowlevellock \
nptl-stack \
nptl_deallocate_tsd \
/* This is at least the second thread. */
pd->header.multiple_threads = 1;
-#ifndef TLS_MULTIPLE_THREADS_IN_TCB
- __libc_multiple_threads = 1;
-#endif
#ifdef NEED_DL_SYSINFO
SETUP_THREAD_SYSINFO (pd);
/* This is at least the second thread. */
pd->header.multiple_threads = 1;
-#ifndef TLS_MULTIPLE_THREADS_IN_TCB
- __libc_multiple_threads = 1;
-#endif
#ifdef NEED_DL_SYSINFO
SETUP_THREAD_SYSINFO (pd);
+++ /dev/null
-/* Copyright (C) 2002-2022 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>
-
-#if IS_IN (libc)
-# ifndef TLS_MULTIPLE_THREADS_IN_TCB
-/* Variable set to a nonzero value either if more than one thread runs or ran,
- or if a single-threaded process is trying to cancel itself. See
- nptl/descr.h for more context on the single-threaded process case. */
-int __libc_multiple_threads;
-libc_hidden_data_def (__libc_multiple_threads)
-# endif
-#endif
points get executed. */
THREAD_SETMEM (THREAD_SELF, header.multiple_threads, 1);
#ifndef TLS_MULTIPLE_THREADS_IN_TCB
- __libc_multiple_threads = 1;
+ __libc_single_threaded_internal = 0;
#endif
}
while (!atomic_compare_exchange_weak_acquire (&pd->cancelhandling, &oldval,
requirement for fork (Austin Group tracker issue #62) this is
best effort to make is async-signal-safe at least for single-thread
case. */
- bool multiple_threads = __libc_single_threaded_internal == 0;
+ bool multiple_threads = !SINGLE_THREAD_P;
uint64_t lastrun;
lastrun = __run_prefork_handlers (multiple_threads);
#define INLINE_SETXID_SYSCALL(name, nr, args...) \
({ \
int __result; \
- if (!__libc_single_threaded_internal) \
+ if (!SINGLE_THREAD_P) \
{ \
struct xid_command __cmd; \
__cmd.syscall_no = __NR_##name; \
--- /dev/null
+#define SINGLE_THREAD_BY_GLOBAL
+#include_next <single-thread.h>
# define HAVE_CLOCK_GETTIME64_VSYSCALL "__kernel_clock_gettime"
# define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday"
-# define SINGLE_THREAD_BY_GLOBAL 1
-
# undef INTERNAL_SYSCALL_RAW
# define INTERNAL_SYSCALL_RAW(name, nr, args...) \
({ long _sys_result; \
#undef SYS_ify
#define SYS_ify(syscall_name) __NR_##syscall_name
-#define SINGLE_THREAD_BY_GLOBAL 1
-
#ifdef __ASSEMBLER__
#include <asm/pal.h>
#include <alpha/regdef.h>
--- /dev/null
+#define SINGLE_THREAD_BY_GLOBAL
+#include_next <single-thread.h>
#else /* !__ASSEMBLER__ */
-# define SINGLE_THREAD_BY_GLOBAL 1
-
# if IS_IN (libc)
extern long int __syscall_error (long int);
hidden_proto (__syscall_error)
--- /dev/null
+#define SINGLE_THREAD_BY_GLOBAL
+#include_next <single-thread.h>
#define INTERNAL_SYSCALL_NCS(number, nr, args...) \
INTERNAL_SYSCALL_RAW (number, nr, args)
-#define SINGLE_THREAD_BY_GLOBAL 1
-
#endif /* __ASSEMBLER__ */
#endif /* linux/arm/sysdep.h */
--- /dev/null
+#define SINGLE_THREAD_BY_GLOBAL
+#include_next <single-thread.h>
#define PTR_MANGLE(var) (void) (var)
#define PTR_DEMANGLE(var) (void) (var)
-#define SINGLE_THREAD_BY_GLOBAL 1
-
#endif /* _LINUX_HPPA_SYSDEP_H */
--- /dev/null
+#define SINGLE_THREAD_BY_GLOBAL
+#include_next <single-thread.h>
# define PTR_MANGLE(var) (void) (var)
# define PTR_DEMANGLE(var) (void) (var)
-# define SINGLE_THREAD_BY_GLOBAL 1
-
#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
--- /dev/null
+#define SINGLE_THREAD_BY_GLOBAL
+#include_next <single-thread.h>
#define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6)
#define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7)
-#define SINGLE_THREAD_BY_GLOBAL 1
-
-
#define VDSO_NAME "LINUX_2.6.29"
#define VDSO_HASH 123718585
#ifndef _SINGLE_THREAD_H
#define _SINGLE_THREAD_H
+#ifndef __ASSEMBLER__
+# include <sys/single_threaded.h>
+#endif
+
/* The default way to check if the process is single thread is by using the
pthread_t 'multiple_threads' field. However, for some architectures it is
faster to either use an extra field on TCB or global variables (the TCB
The ABI might define SINGLE_THREAD_BY_GLOBAL to enable the single thread
check to use global variables instead of the pthread_t field. */
-#ifndef __ASSEMBLER__
-extern int __libc_multiple_threads;
-libc_hidden_proto (__libc_multiple_threads)
-#endif
-
#if !defined SINGLE_THREAD_BY_GLOBAL || IS_IN (rtld)
# define SINGLE_THREAD_P \
(THREAD_GETMEM (THREAD_SELF, header.multiple_threads) == 0)
#else
-# define SINGLE_THREAD_P (__libc_multiple_threads == 0)
+# define SINGLE_THREAD_P (__libc_single_threaded_internal != 0)
#endif
#define RTLD_SINGLE_THREAD_P SINGLE_THREAD_P
--- /dev/null
+#define SINGLE_THREAD_BY_GLOBAL
+#include_next <single-thread.h>
# define HAVE_CLONE3_WRAPPER 1
-# define SINGLE_THREAD_BY_GLOBAL 1
-
#endif /* __ASSEMBLER__ */