about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/clock_gettime.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-12-11 11:13:50 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-01-03 11:22:07 -0300
commitff500a623d1bf9fb24f30fa80451897b534549e1 (patch)
tree135d612e49cd8d6ec19ece7ca5bf16b9d25177be /sysdeps/unix/sysv/linux/clock_gettime.c
parent1bdda52fe92fd01b424cd6fbb63e3df96a95015c (diff)
downloadglibc-ff500a623d1bf9fb24f30fa80451897b534549e1.tar.gz
glibc-ff500a623d1bf9fb24f30fa80451897b534549e1.tar.xz
glibc-ff500a623d1bf9fb24f30fa80451897b534549e1.zip
linux: Add support for clock_gettime64 vDSO
No architecture currently defines the vDSO symbol.  On architectures
with 64-bit time_t the HAVE_CLOCK_GETTIME_VSYSCALL is renamed to
HAVE_CLOCK_GETTIME64_VSYSCALL, it simplifies clock_gettime code.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'sysdeps/unix/sysv/linux/clock_gettime.c')
-rw-r--r--sysdeps/unix/sysv/linux/clock_gettime.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
index 74aadbfbd4..a530daef1c 100644
--- a/sysdeps/unix/sysv/linux/clock_gettime.c
+++ b/sysdeps/unix/sysv/linux/clock_gettime.c
@@ -30,21 +30,24 @@ int
 __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp)
 {
 #ifdef __ASSUME_TIME64_SYSCALLS
-  /* 64 bit ABIs or Newer 32-bit ABIs that only support 64-bit time_t.  */
-# ifdef __NR_clock_gettime64
-  return INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp);
+  /* 64 bit ABIs or newer 32-bit ABIs that only support 64-bit time_t.  */
+# ifndef __NR_clock_gettime64
+#  define __NR_clock_gettime64 __NR_clock_gettime
+# endif
+# ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
+  return INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
 # else
-#  ifdef HAVE_CLOCK_GETTIME_VSYSCALL
-  return INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp);
-#  else
-  return INLINE_SYSCALL_CALL (clock_gettime, clock_id, tp);
-#  endif
+  return INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp);
 # endif
 #else
   int r;
   /* Old 32-bit ABI with possible 64-bit time_t support.  */
 # ifdef __NR_clock_gettime64
+#  ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
+  r = INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
+#  else
   r = INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp);
+#  endif
   if (r == 0 || errno != ENOSYS)
     return r;
 # endif