[12/12] Add support for clock_getres64 vDSO

Message ID 20191212181614.31782-12-adhemerval.zanella@linaro.org
State Dropped
Headers

Commit Message

Adhemerval Zanella Dec. 12, 2019, 6:16 p.m. UTC
  No architecture currently defines the vDSO symbol.
---
 sysdeps/unix/sysv/linux/clock_getres.c  | 12 ++++++++++--
 sysdeps/unix/sysv/linux/dl-vdso-setup.c |  4 ++++
 sysdeps/unix/sysv/linux/dl-vdso-setup.h |  3 +++
 3 files changed, 17 insertions(+), 2 deletions(-)
  

Patch

diff --git a/sysdeps/unix/sysv/linux/clock_getres.c b/sysdeps/unix/sysv/linux/clock_getres.c
index 6c12f1d1e9..39481afe22 100644
--- a/sysdeps/unix/sysv/linux/clock_getres.c
+++ b/sysdeps/unix/sysv/linux/clock_getres.c
@@ -33,7 +33,11 @@  __clock_getres64 (clockid_t clock_id, struct __timespec64 *res)
 #ifdef __ASSUME_TIME64_SYSCALLS
   /* 64 bit ABIs or Newer 32-bit ABIs that only support 64-bit time_t.  */
 # ifdef __NR_clock_getres_time64
-  r = INLINE_SYSCALL_CALL (clock_getres_time64, clock_id, res);
+#  ifdef HAVE_CLOCK_GETRES64_VSYSCALL
+  r = INLINE_VSYSCALL (clock_getres64, 2, clock_id, tp)
+#  endif
+  if (r == -1)
+    r = INLINE_SYSCALL_CALL (clock_getres_time64, clock_id, res);
 # else
 #  ifdef HAVE_CLOCK_GETRES_VSYSCALL
   r = INLINE_VSYSCALL (clock_getres, 2, clock_id, res);
@@ -44,7 +48,11 @@  __clock_getres64 (clockid_t clock_id, struct __timespec64 *res)
 #else
   /* Old 32-bit ABI with possible 64-bit time_t support.  */
 # ifdef __NR_clock_getres_time64
-  r = INLINE_SYSCALL_CALL (clock_getres_time64, clock_id, res);
+#  ifdef HAVE_CLOCK_GETRES64_VSYSCALL
+  r = INLINE_VSYSCALL (clock_getres64, 2, clock_id, tp)
+#  endif
+  if (r == -1)
+    r = INLINE_SYSCALL_CALL (clock_getres_time64, clock_id, res);
 # endif
   if (r == -1)
     {
diff --git a/sysdeps/unix/sysv/linux/dl-vdso-setup.c b/sysdeps/unix/sysv/linux/dl-vdso-setup.c
index d19a4af6c1..620348e2c7 100644
--- a/sysdeps/unix/sysv/linux/dl-vdso-setup.c
+++ b/sysdeps/unix/sysv/linux/dl-vdso-setup.c
@@ -62,6 +62,10 @@  PROCINFO_CLASS int (*_dl_vdso_getcpu) (unsigned *, unsigned *, void *) RELRO;
 PROCINFO_CLASS int (*_dl_vdso_clock_getres) (clockid_t,
 					     struct timespec *) RELRO;
 # endif
+# ifdef HAVE_CLOCK_GETRES64_VSYSCALL
+PROCINFO_CLASS int (*_dl_vdso_clock_getres64) (clockid_t,
+					       struct __timespec64 *) RELRO;
+# endif
 
 /* PowerPC specific ones.  */
 # ifdef HAVE_GET_TBFREQ
diff --git a/sysdeps/unix/sysv/linux/dl-vdso-setup.h b/sysdeps/unix/sysv/linux/dl-vdso-setup.h
index 8a89e100c8..005acf15f7 100644
--- a/sysdeps/unix/sysv/linux/dl-vdso-setup.h
+++ b/sysdeps/unix/sysv/linux/dl-vdso-setup.h
@@ -41,6 +41,9 @@  setup_vdso_pointers (void)
 #ifdef HAVE_CLOCK_GETRES_VSYSCALL
   GLRO(dl_vdso_clock_getres) = dl_vdso_vsym (HAVE_CLOCK_GETRES_VSYSCALL);
 #endif
+#ifdef HAVE_CLOCK_GETRES64_VSYSCALL
+  GLRO(dl_vdso_clock_getres64) = dl_vdso_vsym (HAVE_CLOCK_GETRES64_VSYSCALL);
+#endif
 #ifdef HAVE_GET_TBFREQ
   GLRO(dl_vdso_get_tbfreq) = dl_vdso_vsym (HAVE_GET_TBFREQ);
 #endif