This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 01/12] linux: Fix vDSO macros build with time64 interfaces


* Adhemerval Zanella:

> diff --git a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c b/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
> index 7e772e05ce..07d38466e2 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
> +++ b/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
> @@ -22,10 +22,6 @@
>  
>  #include <time.h>
>  #include <sysdep.h>
> -
> -#ifdef HAVE_GETTIMEOFDAY_VSYSCALL
> -# define HAVE_VSYSCALL
> -#endif
>  #include <sysdep-vdso.h>
>  
>  /* Used as a fallback in the ifunc resolver if VDSO is not available
> @@ -36,7 +32,9 @@ __gettimeofday_vsyscall (struct timeval *restrict tv, void *restrict tz)
>    if (__glibc_unlikely (tz != 0))
>      memset (tz, 0, sizeof *tz);
>  
> -  return INLINE_VSYSCALL (gettimeofday, 2, tv, tz);
> +  if (INLINE_VSYSCALL (gettimeofday, 2, tv, tz) == 0)
> +    return 0;
> +  return INLINE_SYSCALL_CALL (gettimeofday, tv, tz);
>  }

Given that this is the fallback function why do we try INLINE_VSYSCALL
first?

(The static case would need adjusting, of course.)

> diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
> index 875c4fe905..4ea56c9a4b 100644
> --- a/sysdeps/unix/sysv/linux/clock_gettime.c
> +++ b/sysdeps/unix/sysv/linux/clock_gettime.c
> @@ -21,10 +21,6 @@
>  #include <errno.h>
>  #include <time.h>
>  #include "kernel-posix-cpu-timers.h"
> -
> -#ifdef HAVE_CLOCK_GETTIME_VSYSCALL
> -# define HAVE_VSYSCALL
> -#endif
>  #include <sysdep-vdso.h>
>  
>  #include <shlib-compat.h>
> @@ -33,24 +29,39 @@
>  int
>  __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp)
>  {
> +  int r = -1;
> +
>  #ifdef __ASSUME_TIME64_SYSCALLS
> +  /* 64 bit ABIs or Newer 32-bit ABIs that only support 64-bit time_t.  */
> +# ifdef __NR_clock_gettime64
> +  r = INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp);
> +# else
> +#  ifdef HAVE_CLOCK_GETTIME_VSYSCALL
> +  r = INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp);
> +#  endif
> +  if (r == -1)
> +    r = INLINE_SYSCALL_CALL (clock_gettime, clock_id, tp);

Why do you check __NR_clock_gettime64 first?  Won't this make the vDSO
unused?

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]