about summary refs log tree commit diff
path: root/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c b/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c
index bf0551a7e4..7d91528aaf 100644
--- a/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c
+++ b/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c
@@ -21,6 +21,8 @@
 #include <list.h>
 #include "fork.h"
 #include <tls.h>
+#include <string.h>
+#include <pthreadP.h>
 #include <bits/libc-lock.h>
 
 
@@ -28,9 +30,10 @@ static struct fork_handler pthread_child_handler;
 
 
 void
-__libc_pthread_init (ptr, reclaim)
+__libc_pthread_init (ptr, reclaim, functions)
      unsigned long int *ptr;
      void (*reclaim) (void);
+     const struct pthread_functions *functions;
 {
   /* Remember the pointer to the generation counter in libpthread.  */
   __fork_generation_pointer = ptr;
@@ -41,6 +44,14 @@ __libc_pthread_init (ptr, reclaim)
   /* The fork handler needed by libpthread.  */
   list_add_tail (&pthread_child_handler.list, &__fork_child_list);
 
+#ifdef SHARED
+  /* We copy the content of the variable pointed to by the FUNCTIONS
+     parameter to one in libc.so since this means access to the array
+     can be done with one memory access instead of two.  */
+  memcpy (&__libc_pthread_functions, functions,
+	  sizeof (__libc_pthread_functions));
+#endif
+
   /* We have a macro which is used in asm code describing data layout.
      Make sure it does not get out of date.  */
   if (offsetof (struct pthread, header.data.multiple_threads)