about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/nptl/futex-internal.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/sysdeps/nptl/futex-internal.h b/sysdeps/nptl/futex-internal.h
index 969ab2bf4b..79a366604d 100644
--- a/sysdeps/nptl/futex-internal.h
+++ b/sysdeps/nptl/futex-internal.h
@@ -254,15 +254,23 @@ static __always_inline int
 futex_lock_pi64 (int *futex_word, const struct __timespec64 *abstime,
                  int private)
 {
-  int err = INTERNAL_SYSCALL_CALL (futex_time64, futex_word,
-                                   __lll_private_flag
-                                   (FUTEX_LOCK_PI, private), 0, abstime);
-#ifndef __ASSUME_TIME64_SYSCALLS
-  if (err == -ENOSYS)
+  int err;
+#ifdef __ASSUME_TIME64_SYSCALLS
+  err = INTERNAL_SYSCALL_CALL (futex_time64, futex_word,
+			       __lll_private_flag (FUTEX_LOCK_PI, private), 0,
+			       abstime);
+#else
+  bool need_time64 = abstime != NULL && !in_time_t_range (abstime->tv_sec);
+  if (need_time64)
+    {
+      err = INTERNAL_SYSCALL_CALL (futex_time64, futex_word,
+				   __lll_private_flag (FUTEX_LOCK_PI, private),
+				   0, abstime);
+      if (err == -ENOSYS)
+	err = -EOVERFLOW;
+    }
+  else
     {
-      if (abstime != NULL && ! in_time_t_range (abstime->tv_sec))
-        return EOVERFLOW;
-
       struct timespec ts32;
       if (abstime != NULL)
         ts32 = valid_timespec64_to_timespec (*abstime);