]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
linux: Add support for clock_getres64 vDSO
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 11 Dec 2019 19:39:01 +0000 (16:39 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 3 Jan 2020 14:22:07 +0000 (11:22 -0300)
No architecture currently defines the vDSO symbol.  On archictures
with 64-bit time_t the HAVE_CLOCK_GETRES_VSYSCALL is renamed to
HAVE_CLOCK_GETRES64_VSYSCALL, it simplifies clock_gettime code.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
sysdeps/unix/sysv/linux/aarch64/sysdep.h
sysdeps/unix/sysv/linux/clock_getres.c
sysdeps/unix/sysv/linux/dl-vdso-setup.c
sysdeps/unix/sysv/linux/dl-vdso-setup.h
sysdeps/unix/sysv/linux/powerpc/sysdep.h
sysdeps/unix/sysv/linux/riscv/sysdep.h
sysdeps/unix/sysv/linux/s390/sysdep.h
sysdeps/unix/sysv/linux/x86_64/sysdep.h

index 982851287c89cb26854383d26eece64828792910..00b8e241c8b75f99060284039c5e23e1a151fc05 100644 (file)
 # endif
 
 /* List of system calls which are supported as vsyscalls.  */
-# define HAVE_CLOCK_GETRES_VSYSCALL    "__kernel_clock_getres"
+# define HAVE_CLOCK_GETRES64_VSYSCALL  "__kernel_clock_getres"
 # define HAVE_CLOCK_GETTIME64_VSYSCALL "__kernel_clock_gettime"
 # define HAVE_GETTIMEOFDAY_VSYSCALL    "__kernel_gettimeofday"
 
index d3cabfcb2fd2d69d2c70dbbe5bf24bc69e19f28c..2ba72110ba5417319b69cb373ca05c0481004608 100644 (file)
@@ -30,20 +30,23 @@ __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
-  return INLINE_SYSCALL_CALL (clock_getres_time64, clock_id, res);
+# ifndef __NR_clock_getres_time64
+#  define __NR_clock_getres_time64 __NR_clock_getres
+# endif
+# ifdef HAVE_CLOCK_GETRES64_VSYSCALL
+  return INLINE_VSYSCALL (clock_getres_time64, 2, clock_id, res);
 # else
-#  ifdef HAVE_CLOCK_GETRES_VSYSCALL
-  return INLINE_VSYSCALL (clock_getres, 2, clock_id, res);
-#  else
-  return INLINE_SYSCALL_CALL (clock_getres, clock_id, res);
-#  endif
+  return INLINE_SYSCALL_CALL (clock_getres_time64, clock_id, res);
 # endif
 #else
   int r;
   /* Old 32-bit ABI with possible 64-bit time_t support.  */
 # ifdef __NR_clock_getres_time64
+#  ifdef HAVE_CLOCK_GETRES64_VSYSCALL
+  r = INLINE_VSYSCALL (clock_getres_time64, 2, clock_id, res);
+#  else
   r = INLINE_SYSCALL_CALL (clock_getres_time64, clock_id, res);
+#  endif
   if (r == 0 || errno != ENOSYS)
     return r;
 # endif
index 3e92aa1f98e7fca8330ba5f40e0b3f895b8ffb81..a315a95e76f3b540ec7780816e2428be5cf7397b 100644 (file)
@@ -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_getres_time64) (clockid_t,
+                                                   struct __timespec64 *) RELRO;
+# endif
 
 /* PowerPC specific ones.  */
 # ifdef HAVE_GET_TBFREQ
index 11a1e867aea81d02b023eed6b65ed83b125c91af..3a9878c29e68568f6f5cf43c0b094cc7e14ad8ab 100644 (file)
@@ -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_getres_time64) = dl_vdso_vsym (HAVE_CLOCK_GETRES64_VSYSCALL);
+#endif
 #ifdef HAVE_GET_TBFREQ
   GLRO(dl_vdso_get_tbfreq) = dl_vdso_vsym (HAVE_GET_TBFREQ);
 #endif
index 4491ddc421396c22741e267fedc218e539d8e3a5..1f477a945d7b87659270698b37e7ef77dee766be 100644 (file)
 #define VDSO_HASH  123718565
 
 /* List of system calls which are supported as vsyscalls.  */
-#define HAVE_CLOCK_GETRES_VSYSCALL     "__kernel_clock_getres"
 #if defined(__PPC64__) || defined(__powerpc64__)
+#define HAVE_CLOCK_GETRES64_VSYSCALL   "__kernel_clock_getres"
 #define HAVE_CLOCK_GETTIME64_VSYSCALL  "__kernel_clock_gettime"
 #else
+#define HAVE_CLOCK_GETRES_VSYSCALL     "__kernel_clock_getres"
 #define HAVE_CLOCK_GETTIME_VSYSCALL    "__kernel_clock_gettime"
 #endif
 #define HAVE_GETCPU_VSYSCALL           "__kernel_getcpu"
index 7f43595cb0c71c490b52a9f3ead1c301a0f349ca..201bf9a91b967575fe45f8c2eac41d3dd297f1e0 100644 (file)
 # define VDSO_HASH  182943605
 
 /* List of system calls which are supported as vsyscalls.  */
-# define HAVE_CLOCK_GETRES_VSYSCALL    "__vdso_clock_getres"
+# define HAVE_CLOCK_GETRES64_VSYSCALL  "__vdso_clock_getres"
 # define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime"
 # define HAVE_GETTIMEOFDAY_VSYSCALL    "__vdso_gettimeofday"
 # define HAVE_GETCPU_VSYSCALL          "__vdso_getcpu"
index a53c8ff44bb11464f475b5e6d68052257437df9c..33ed86f2526041272d4d292df7877559e26d7b1f 100644 (file)
 #define VDSO_HASH  123718585
 
 /* List of system calls which are supported as vsyscalls.  */
-#define HAVE_CLOCK_GETRES_VSYSCALL     "__kernel_clock_getres"
 #ifdef __s390x__
+#define HAVE_CLOCK_GETRES64_VSYSCALL   "__kernel_clock_getres"
 #define HAVE_CLOCK_GETTIME64_VSYSCALL  "__kernel_clock_gettime"
 #else
+#define HAVE_CLOCK_GETRES_VSYSCALL     "__kernel_clock_getres"
 #define HAVE_CLOCK_GETTIME_VSYSCALL    "__kernel_clock_gettime"
 #endif
 #define HAVE_GETTIMEOFDAY_VSYSCALL     "__kernel_gettimeofday"
index 46df401c2da03bd0d1e4006b01d9c0e9b113ffc6..c2eb37e5753bc14359d05262db23307df18987fc 100644 (file)
 # define HAVE_GETTIMEOFDAY_VSYSCALL     "__vdso_gettimeofday"
 # define HAVE_TIME_VSYSCALL             "__vdso_time"
 # define HAVE_GETCPU_VSYSCALL          "__vdso_getcpu"
-# define HAVE_CLOCK_GETRES_VSYSCALL     "__vdso_clock_getres"
+# define HAVE_CLOCK_GETRES64_VSYSCALL   "__vdso_clock_getres"
 
 # define SINGLE_THREAD_BY_GLOBAL               1