summaryrefslogtreecommitdiff
path: root/nptl/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/init.c')
-rw-r--r--nptl/init.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/nptl/init.c b/nptl/init.c
index d445de0795..af5bb24b59 100644
--- a/nptl/init.c
+++ b/nptl/init.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -18,6 +18,7 @@
02111-1307 USA. */
#include <assert.h>
+#include <errno.h>
#include <limits.h>
#include <signal.h>
#include <stdlib.h>
@@ -49,6 +50,15 @@ int __set_robust_list_avail;
# define set_robust_list_not_avail() do { } while (0)
#endif
+#ifndef __ASSUME_FUTEX_CLOCK_REALTIME
+/* Nonzero if we do not have FUTEX_CLOCK_REALTIME. */
+int __have_futex_clock_realtime;
+# define __set_futex_clock_realtime() \
+ __have_futex_clock_realtime = 1
+#else
+#define __set_futex_clock_realtime() do { } while (0)
+#endif
+
/* Version of the library, used in libthread_db to detect mismatches. */
static const char nptl_version[] __attribute_used__ = VERSION;
@@ -292,6 +302,20 @@ __pthread_initialize_minimal_internal (void)
}
#endif
+#ifndef __ASSUME_FUTEX_CLOCK_REALTIME
+ {
+ int word = 0;
+ word = INTERNAL_SYSCALL (futex, err, 6, &word,
+ FUTEX_WAIT_BITSET | FUTEX_CLOCK_REALTIME
+ | FUTEX_PRIVATE_FLAG, 1, NULL, 0,
+ FUTEX_BITSET_MATCH_ANY);
+ if (!INTERNAL_SYSCALL_ERROR_P (word, err)
+ || (INTERNAL_SYSCALL_ERRNO (word, err) != ENOSYS
+ && INTERNAL_SYSCALL_ERRNO (word, err) != EINVAL))
+ __set_futex_clock_realtime ();
+ }
+#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. */