93dc2d
commit 8ad6d6d8ed33631bd2ca5d1112e6da2f92731432
93dc2d
Author: maminjie <maminjie2@huawei.com>
93dc2d
Date:   Mon Dec 20 19:36:32 2021 +0800
93dc2d
93dc2d
    Linux: Fix 32-bit vDSO for clock_gettime on powerpc32
93dc2d
    
93dc2d
    When the clock_id is CLOCK_PROCESS_CPUTIME_ID or CLOCK_THREAD_CPUTIME_ID,
93dc2d
    on the 5.10 kernel powerpc 32-bit, the 32-bit vDSO is executed successfully (
93dc2d
    because the __kernel_clock_gettime in arch/powerpc/kernel/vdso32/gettimeofday.S
93dc2d
    does not support these two IDs, the 32-bit time_t syscall will be used),
93dc2d
    but tp32.tv_sec is equal to 0, causing the 64-bit time_t syscall to continue to be used,
93dc2d
    resulting in two system calls.
93dc2d
    
93dc2d
    Fix commit 72e84d1db22203e01a43268de71ea8669eca2863.
93dc2d
    
93dc2d
    Signed-off-by: maminjie  <maminjie2@huawei.com>
93dc2d
    Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
93dc2d
    
93dc2d
    (cherry picked from commit e0fc721ce600038dd390e77cfe52440707ef574d)
93dc2d
93dc2d
diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
93dc2d
index 91df6b3d967bf945..9c7d9073254843c7 100644
93dc2d
--- a/sysdeps/unix/sysv/linux/clock_gettime.c
93dc2d
+++ b/sysdeps/unix/sysv/linux/clock_gettime.c
93dc2d
@@ -53,7 +53,7 @@ __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp)
93dc2d
     {
93dc2d
       struct timespec tp32;
93dc2d
       r = INTERNAL_VSYSCALL_CALL (vdso_time, 2, clock_id, &tp32);
93dc2d
-      if (r == 0 && tp32.tv_sec > 0)
93dc2d
+      if (r == 0 && tp32.tv_sec >= 0)
93dc2d
 	{
93dc2d
 	  *tp = valid_timespec_to_timespec64 (tp32);
93dc2d
 	  return 0;