This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[COMMITTED PATCH] NPTL: Move fork state variables to initializer files.
- From: Roland McGrath <roland at hack dot frob dot com>
- To: "GNU C. Library" <libc-alpha at sourceware dot org>
- Date: Wed, 17 Dec 2014 15:24:26 -0800 (PST)
- Subject: [COMMITTED PATCH] NPTL: Move fork state variables to initializer files.
- Authentication-results: sourceware.org; auth=none
This has no material effect on existing configurations, except perhaps
reducing dead code brought in when statically linking libpthread.a in.
It moves each definition into the translation unit using it that is closest
to the root of the link dependency graph.
Tested x86_64-linux-gnu.
Thanks,
Roland
* sysdeps/nptl/fork.c (__fork_generation_pointer): Variable moved ...
* nptl/libc_pthread_init.c: ... here.
* sysdeps/nptl/fork.c (__fork_handlers): Variable moved ...
* nptl/register-atfork.c: ... here.
--- a/nptl/libc_pthread_init.c
+++ b/nptl/libc_pthread_init.c
@@ -28,6 +28,9 @@
#include <ldsodefs.h>
+unsigned long int *__fork_generation_pointer;
+
+
#ifdef TLS_MULTIPLE_THREADS_IN_TCB
void
#else
--- a/nptl/register-atfork.c
+++ b/nptl/register-atfork.c
@@ -23,6 +23,8 @@
#include <atomic.h>
+struct fork_handler *__fork_handlers;
+
/* Lock to protect allocation and deallocation of fork handlers. */
int __fork_lock = LLL_LOCK_INITIALIZER;
--- a/sysdeps/nptl/fork.c
+++ b/sysdeps/nptl/fork.c
@@ -32,14 +32,6 @@
#include <arch-fork.h>
-unsigned long int *__fork_generation_pointer;
-
-
-
-/* The single linked list of all currently registered fork handlers. */
-struct fork_handler *__fork_handlers;
-
-
static void
fresetlockfiles (void)
{