mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
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>
This commit is contained in:
@ -160,7 +160,7 @@
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* List of system calls which are supported as vsyscalls. */
|
/* 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_CLOCK_GETTIME64_VSYSCALL "__kernel_clock_gettime"
|
||||||
# define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday"
|
# define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday"
|
||||||
|
|
||||||
|
@ -30,20 +30,23 @@ __clock_getres64 (clockid_t clock_id, struct __timespec64 *res)
|
|||||||
{
|
{
|
||||||
#ifdef __ASSUME_TIME64_SYSCALLS
|
#ifdef __ASSUME_TIME64_SYSCALLS
|
||||||
/* 64 bit ABIs or Newer 32-bit ABIs that only support 64-bit time_t. */
|
/* 64 bit ABIs or Newer 32-bit ABIs that only support 64-bit time_t. */
|
||||||
# ifdef __NR_clock_getres_time64
|
# ifndef __NR_clock_getres_time64
|
||||||
return INLINE_SYSCALL_CALL (clock_getres_time64, clock_id, res);
|
# 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
|
# else
|
||||||
# ifdef HAVE_CLOCK_GETRES_VSYSCALL
|
return INLINE_SYSCALL_CALL (clock_getres_time64, clock_id, res);
|
||||||
return INLINE_VSYSCALL (clock_getres, 2, clock_id, res);
|
|
||||||
# else
|
|
||||||
return INLINE_SYSCALL_CALL (clock_getres, clock_id, res);
|
|
||||||
# endif
|
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
int r;
|
int r;
|
||||||
/* Old 32-bit ABI with possible 64-bit time_t support. */
|
/* Old 32-bit ABI with possible 64-bit time_t support. */
|
||||||
# ifdef __NR_clock_getres_time64
|
# 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);
|
r = INLINE_SYSCALL_CALL (clock_getres_time64, clock_id, res);
|
||||||
|
# endif
|
||||||
if (r == 0 || errno != ENOSYS)
|
if (r == 0 || errno != ENOSYS)
|
||||||
return r;
|
return r;
|
||||||
# endif
|
# endif
|
||||||
|
@ -62,6 +62,10 @@ PROCINFO_CLASS int (*_dl_vdso_getcpu) (unsigned *, unsigned *, void *) RELRO;
|
|||||||
PROCINFO_CLASS int (*_dl_vdso_clock_getres) (clockid_t,
|
PROCINFO_CLASS int (*_dl_vdso_clock_getres) (clockid_t,
|
||||||
struct timespec *) RELRO;
|
struct timespec *) RELRO;
|
||||||
# endif
|
# endif
|
||||||
|
# ifdef HAVE_CLOCK_GETRES64_VSYSCALL
|
||||||
|
PROCINFO_CLASS int (*_dl_vdso_clock_getres_time64) (clockid_t,
|
||||||
|
struct __timespec64 *) RELRO;
|
||||||
|
# endif
|
||||||
|
|
||||||
/* PowerPC specific ones. */
|
/* PowerPC specific ones. */
|
||||||
# ifdef HAVE_GET_TBFREQ
|
# ifdef HAVE_GET_TBFREQ
|
||||||
|
@ -41,6 +41,9 @@ setup_vdso_pointers (void)
|
|||||||
#ifdef HAVE_CLOCK_GETRES_VSYSCALL
|
#ifdef HAVE_CLOCK_GETRES_VSYSCALL
|
||||||
GLRO(dl_vdso_clock_getres) = dl_vdso_vsym (HAVE_CLOCK_GETRES_VSYSCALL);
|
GLRO(dl_vdso_clock_getres) = dl_vdso_vsym (HAVE_CLOCK_GETRES_VSYSCALL);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_CLOCK_GETRES64_VSYSCALL
|
||||||
|
GLRO(dl_vdso_clock_getres_time64) = dl_vdso_vsym (HAVE_CLOCK_GETRES64_VSYSCALL);
|
||||||
|
#endif
|
||||||
#ifdef HAVE_GET_TBFREQ
|
#ifdef HAVE_GET_TBFREQ
|
||||||
GLRO(dl_vdso_get_tbfreq) = dl_vdso_vsym (HAVE_GET_TBFREQ);
|
GLRO(dl_vdso_get_tbfreq) = dl_vdso_vsym (HAVE_GET_TBFREQ);
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,10 +20,11 @@
|
|||||||
#define VDSO_HASH 123718565
|
#define VDSO_HASH 123718565
|
||||||
|
|
||||||
/* List of system calls which are supported as vsyscalls. */
|
/* List of system calls which are supported as vsyscalls. */
|
||||||
#define HAVE_CLOCK_GETRES_VSYSCALL "__kernel_clock_getres"
|
|
||||||
#if defined(__PPC64__) || defined(__powerpc64__)
|
#if defined(__PPC64__) || defined(__powerpc64__)
|
||||||
|
#define HAVE_CLOCK_GETRES64_VSYSCALL "__kernel_clock_getres"
|
||||||
#define HAVE_CLOCK_GETTIME64_VSYSCALL "__kernel_clock_gettime"
|
#define HAVE_CLOCK_GETTIME64_VSYSCALL "__kernel_clock_gettime"
|
||||||
#else
|
#else
|
||||||
|
#define HAVE_CLOCK_GETRES_VSYSCALL "__kernel_clock_getres"
|
||||||
#define HAVE_CLOCK_GETTIME_VSYSCALL "__kernel_clock_gettime"
|
#define HAVE_CLOCK_GETTIME_VSYSCALL "__kernel_clock_gettime"
|
||||||
#endif
|
#endif
|
||||||
#define HAVE_GETCPU_VSYSCALL "__kernel_getcpu"
|
#define HAVE_GETCPU_VSYSCALL "__kernel_getcpu"
|
||||||
|
@ -125,7 +125,7 @@
|
|||||||
# define VDSO_HASH 182943605
|
# define VDSO_HASH 182943605
|
||||||
|
|
||||||
/* List of system calls which are supported as vsyscalls. */
|
/* 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_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime"
|
||||||
# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
|
# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
|
||||||
# define HAVE_GETCPU_VSYSCALL "__vdso_getcpu"
|
# define HAVE_GETCPU_VSYSCALL "__vdso_getcpu"
|
||||||
|
@ -20,10 +20,11 @@
|
|||||||
#define VDSO_HASH 123718585
|
#define VDSO_HASH 123718585
|
||||||
|
|
||||||
/* List of system calls which are supported as vsyscalls. */
|
/* List of system calls which are supported as vsyscalls. */
|
||||||
#define HAVE_CLOCK_GETRES_VSYSCALL "__kernel_clock_getres"
|
|
||||||
#ifdef __s390x__
|
#ifdef __s390x__
|
||||||
|
#define HAVE_CLOCK_GETRES64_VSYSCALL "__kernel_clock_getres"
|
||||||
#define HAVE_CLOCK_GETTIME64_VSYSCALL "__kernel_clock_gettime"
|
#define HAVE_CLOCK_GETTIME64_VSYSCALL "__kernel_clock_gettime"
|
||||||
#else
|
#else
|
||||||
|
#define HAVE_CLOCK_GETRES_VSYSCALL "__kernel_clock_getres"
|
||||||
#define HAVE_CLOCK_GETTIME_VSYSCALL "__kernel_clock_gettime"
|
#define HAVE_CLOCK_GETTIME_VSYSCALL "__kernel_clock_gettime"
|
||||||
#endif
|
#endif
|
||||||
#define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday"
|
#define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday"
|
||||||
|
@ -368,7 +368,7 @@
|
|||||||
# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
|
# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
|
||||||
# define HAVE_TIME_VSYSCALL "__vdso_time"
|
# define HAVE_TIME_VSYSCALL "__vdso_time"
|
||||||
# define HAVE_GETCPU_VSYSCALL "__vdso_getcpu"
|
# 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
|
# define SINGLE_THREAD_BY_GLOBAL 1
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user