about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-12-11 16:39:01 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-01-03 11:22:07 -0300
commit0dc1a378b135ec46fcc451d96c4a3a64c08e2ace (patch)
treeb263a60c36a5cb2ad7d3b2b9affa7cad36c809c0 /sysdeps
parentcdae973b6a7eb95b1caf1e1ecfc93de720ac6b44 (diff)
downloadglibc-0dc1a378b135ec46fcc451d96c4a3a64c08e2ace.tar.gz
glibc-0dc1a378b135ec46fcc451d96c4a3a64c08e2ace.tar.xz
glibc-0dc1a378b135ec46fcc451d96c4a3a64c08e2ace.zip
linux: Add support for clock_getres64 vDSO
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>
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/sysdep.h2
-rw-r--r--sysdeps/unix/sysv/linux/clock_getres.c17
-rw-r--r--sysdeps/unix/sysv/linux/dl-vdso-setup.c4
-rw-r--r--sysdeps/unix/sysv/linux/dl-vdso-setup.h3
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/sysdep.h3
-rw-r--r--sysdeps/unix/sysv/linux/riscv/sysdep.h2
-rw-r--r--sysdeps/unix/sysv/linux/s390/sysdep.h3
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sysdep.h2
8 files changed, 24 insertions, 12 deletions
diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
index 982851287c..00b8e241c8 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
@@ -160,7 +160,7 @@
 # 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"
 
diff --git a/sysdeps/unix/sysv/linux/clock_getres.c b/sysdeps/unix/sysv/linux/clock_getres.c
index d3cabfcb2f..2ba72110ba 100644
--- a/sysdeps/unix/sysv/linux/clock_getres.c
+++ b/sysdeps/unix/sysv/linux/clock_getres.c
@@ -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
diff --git a/sysdeps/unix/sysv/linux/dl-vdso-setup.c b/sysdeps/unix/sysv/linux/dl-vdso-setup.c
index 3e92aa1f98..a315a95e76 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_getres_time64) (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 11a1e867ae..3a9878c29e 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_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
diff --git a/sysdeps/unix/sysv/linux/powerpc/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/sysdep.h
index 4491ddc421..1f477a945d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/sysdep.h
@@ -20,10 +20,11 @@
 #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"
diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h
index 7f43595cb0..201bf9a91b 100644
--- a/sysdeps/unix/sysv/linux/riscv/sysdep.h
+++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h
@@ -125,7 +125,7 @@
 # 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"
diff --git a/sysdeps/unix/sysv/linux/s390/sysdep.h b/sysdeps/unix/sysv/linux/s390/sysdep.h
index a53c8ff44b..33ed86f252 100644
--- a/sysdeps/unix/sysv/linux/s390/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/sysdep.h
@@ -20,10 +20,11 @@
 #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"
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index 46df401c2d..c2eb37e575 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -368,7 +368,7 @@
 # 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