summaryrefslogtreecommitdiff
path: root/nptl/init.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-05-23 20:51:45 +0000
committerUlrich Drepper <drepper@redhat.com>2007-05-23 20:51:45 +0000
commit5a8075b116280d0c1ece277e4be75250efca45b2 (patch)
tree7c63a4ba94c14bc46ececab97c299aff01078fb7 /nptl/init.c
parent6d59823c29df228415836f289e62064f95849e71 (diff)
* init.c (__pthread_initialize_minimal_internal): Check whether
private futexes are available. * allocatestack.c (allocate_stack): Copy private_futex field from current thread into the new stack. * sysdeps/unix/sysv/linux/x86_64/libc-lowlevellock.S: Use private futexes if they are available. * sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: Likewise * sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Adjust so that change in libc-lowlevellock.S allow using private futexes. * sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Likewise. * sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Define FUTEX_PRIVATE_FLAG. * sysdeps/unix/sysv/linux/i386/lowlevellock.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/pthread_once.S: Use private futexes if they are available. * sysdeps/unix/sysv/linux/i386/pthread_once.S: Likewise. * sysdeps/x86_64/tcb-offsets.sym: Add PRIVATE_FUTEX. * sysdeps/i386/tcb-offsets.sym: Likewise. * sysdeps/x86_64/tls.h (tcbhead_t): Add private_futex field. * sysdeps/i386/tls.h (tcbhead_t): Likewise.
Diffstat (limited to 'nptl/init.c')
-rw-r--r--nptl/init.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/nptl/init.c b/nptl/init.c
index f67467aa5a..ff81087d0c 100644
--- a/nptl/init.c
+++ b/nptl/init.c
@@ -276,6 +276,18 @@ __pthread_initialize_minimal_internal (void)
#endif
set_robust_list_not_avail ();
+#ifndef __ASSUME_PRIVATE_FUTEX
+ /* Private futexes are always used (at least internally) so that
+ doing the test once this early is beneficial. */
+ {
+ int word;
+ res = INTERNAL_SYSCALL (futex, err, 3, &word,
+ FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1);
+ if (!INTERNAL_SYSCALL_ERROR_P (res, err))
+ THREAD_SETMEM (pd, header.private_futex, FUTEX_PRIVATE_FLAG);
+ }
+#endif
+
/* Set initial thread's stack block from 0 up to __libc_stack_end.
It will be bigger than it actually is, but for unwind.c/pt-longjmp.c
purposes this is good enough. */