From c136ded1fc4c02ed2096bfdf79e1dbe7623fe2eb Mon Sep 17 00:00:00 2001
From: Peter S. Mazinger <ps.m@gmx.net>
Date: Tue, 22 Mar 2011 00:20:36 +0100
Subject: [PATCH 164/396] sysconf.c: the clock_getres function is good for NPTL as well

Even if glibc reuses the syscall (bloat), we can reuse the function.
Make sure, that we use it only if it is provided by the syscall
and the function is really around (UCLIBC_HAS_REALTIME disables it),
else we get into a loop.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
---
 libc/unistd/sysconf.c |   13 +------------
 1 files changed, 1 insertions(+), 12 deletions(-)

diff --git a/libc/unistd/sysconf.c b/libc/unistd/sysconf.c
index bef6bb2..436a35f 100644
--- a/libc/unistd/sysconf.c
+++ b/libc/unistd/sysconf.c
@@ -984,20 +984,9 @@ long int sysconf(int name)
 #endif
 
     case _SC_MONOTONIC_CLOCK:
-#ifdef __NR_clock_getres
-    /* Check using the clock_getres system call.  */
-# ifdef __UCLIBC_HAS_THREADS_NATIVE__
-    {
-      struct timespec ts;
-      INTERNAL_SYSCALL_DECL (err);
-      int r;
-      r = INTERNAL_SYSCALL (clock_getres, err, 2, CLOCK_MONOTONIC, &ts);
-      return INTERNAL_SYSCALL_ERROR_P (r, err) ? -1 : _POSIX_VERSION;
-    }
-# elif defined __UCLIBC_HAS_REALTIME__
+#if defined __UCLIBC_HAS_REALTIME__ && defined __NR_clock_getres
       if (clock_getres(CLOCK_MONOTONIC, NULL) >= 0)
         return _POSIX_VERSION;
-# endif
 #endif
       RETURN_NEG_1;
 
-- 
1.7.0.4

