summaryrefslogtreecommitdiff
path: root/nscd/connections.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-10-05 08:25:34 +0000
committerJakub Jelinek <jakub@redhat.com>2004-10-05 08:25:34 +0000
commitfd63f7c6ce353ccfdbba58a37e8ef5465fcedfe4 (patch)
treed68e6563180c849e8c5a37b646903b82c4302c1e /nscd/connections.c
parent85148842d401edf64f9edee7e5819a947c289ed2 (diff)
Updated to fedora-glibc-20041005T0745
Diffstat (limited to 'nscd/connections.c')
-rw-r--r--nscd/connections.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/nscd/connections.c b/nscd/connections.c
index 2bd3bec5b0..d9c11f5425 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -21,6 +21,7 @@
#include <alloca.h>
#include <assert.h>
#include <atomic.h>
+#include <dlfcn.h>
#include <error.h>
#include <errno.h>
#include <fcntl.h>
@@ -42,6 +43,7 @@
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/un.h>
+#include <gnu/lib-names.h>
#include "nscd.h"
#include "dbg_log.h"
@@ -1455,12 +1457,39 @@ start_threads (void)
pthread_condattr_t condattr;
pthread_condattr_init (&condattr);
-#if _POSIX_CLOCK_SELECTION >= 0 && _POSIX_MONOTONIC_CLOCK >= 0
+#if defined _POSIX_MONOTONIC_CLOCK && _POSIX_MONOTONIC_CLOCK >= 0
/* Determine whether the monotonous clock is available. */
struct timespec dummy;
- if (clock_getres (CLOCK_MONOTONIC, &dummy) == 0
- && pthread_condattr_setclock (&condattr, CLOCK_MONOTONIC) == 0)
- timeout_clock = CLOCK_MONOTONIC;
+# if _POSIX_MONOTONIC_CLOCK == 0
+ if (sysconf (_SC_MONOTONIC_CLOCK) > 0)
+# endif
+ {
+# if defined _POSIX_CLOCK_SELECTION && _POSIX_CLOCK_SELECTION >= 0
+# if _POSIX_CLOCK_SELECTION == 0
+ if (sysconf (_SC_CLOCK_SELECTION) > 0)
+# endif
+ if (clock_getres (CLOCK_MONOTONIC, &dummy) == 0
+ && pthread_condattr_setclock (&condattr, CLOCK_MONOTONIC) == 0)
+ timeout_clock = CLOCK_MONOTONIC;
+# elif _POSIX_THREADS > 0
+ if (sysconf (_SC_CLOCK_SELECTION) > 0)
+ {
+ void *h = __libc_dlopen (LIBPTHREAD_SO);
+ int (*condattr_setclock) (pthread_condattr_t *, __clockid_t) = NULL;
+
+ if (h != NULL)
+ condattr_setclock = __libc_dlsym (h, "pthread_condattr_setclock");
+
+ if (condattr_setclock
+ && clock_getres (CLOCK_MONOTONIC, &dummy) == 0
+ && condattr_setclock (&condattr, CLOCK_MONOTONIC) == 0)
+ timeout_clock = CLOCK_MONOTONIC;
+
+ if (h != NULL)
+ __libc_dlclose (h);
+ }
+# endif
+ }
#endif
pthread_cond_init (&readylist_cond, &condattr);