aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-01-18 15:32:02 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-03-12 10:19:49 -0300
commit2883de072093ecdb3369cdcd72d69d4fc7b5ae71 (patch)
tree2c6d281bfa9716e398dbf162887825eb1127f811
parent2b47727c68b6329cf8890e56fc9dbaa4e7300961 (diff)
downloadglibc-2883de072093ecdb3369cdcd72d69d4fc7b5ae71.tar
glibc-2883de072093ecdb3369cdcd72d69d4fc7b5ae71.tar.gz
glibc-2883de072093ecdb3369cdcd72d69d4fc7b5ae71.tar.bz2
glibc-2883de072093ecdb3369cdcd72d69d4fc7b5ae71.zip
linux: Use __libc_single_threaded on fork
Checked on x86_64-linux-gnu.
-rw-r--r--sysdeps/nptl/fork.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sysdeps/nptl/fork.c b/sysdeps/nptl/fork.c
index 4fb4c2d254..f78267b68c 100644
--- a/sysdeps/nptl/fork.c
+++ b/sysdeps/nptl/fork.c
@@ -34,6 +34,7 @@
#include <malloc/malloc-internal.h>
#include <nss/nss_database.h>
#include <unwind-link.h>
+#include <sys/single_threaded.h>
static void
fresetlockfiles (void)
@@ -55,7 +56,7 @@ __libc_fork (void)
handlers in the single-thread case, to make fork safer to use in
signal handlers. POSIX requires that fork is async-signal-safe,
but our current fork implementation is not. */
- bool multiple_threads = THREAD_GETMEM (THREAD_SELF, header.multiple_threads);
+ bool multiple_threads = __libc_single_threaded == 0;
__run_fork_handlers (atfork_run_prepare, multiple_threads);