public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] Linux: Fix 32-bit vDSO for clock_gettime on powerpc32
@ 2021-12-21 12:49 Adhemerval Zanella
  0 siblings, 0 replies; only message in thread
From: Adhemerval Zanella @ 2021-12-21 12:49 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e0fc721ce600038dd390e77cfe52440707ef574d

commit e0fc721ce600038dd390e77cfe52440707ef574d
Author: maminjie <maminjie2@huawei.com>
Date:   Mon Dec 20 19:36:32 2021 +0800

    Linux: Fix 32-bit vDSO for clock_gettime on powerpc32
    
    When the clock_id is CLOCK_PROCESS_CPUTIME_ID or CLOCK_THREAD_CPUTIME_ID,
    on the 5.10 kernel powerpc 32-bit, the 32-bit vDSO is executed successfully (
    because the __kernel_clock_gettime in arch/powerpc/kernel/vdso32/gettimeofday.S
    does not support these two IDs, the 32-bit time_t syscall will be used),
    but tp32.tv_sec is equal to 0, causing the 64-bit time_t syscall to continue to be used,
    resulting in two system calls.
    
    Fix commit 72e84d1db22203e01a43268de71ea8669eca2863.
    
    Signed-off-by: maminjie  <maminjie2@huawei.com>
    Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

Diff:
---
 sysdeps/unix/sysv/linux/clock_gettime.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
index 91df6b3d96..9c7d907325 100644
--- a/sysdeps/unix/sysv/linux/clock_gettime.c
+++ b/sysdeps/unix/sysv/linux/clock_gettime.c
@@ -53,7 +53,7 @@ __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp)
     {
       struct timespec tp32;
       r = INTERNAL_VSYSCALL_CALL (vdso_time, 2, clock_id, &tp32);
-      if (r == 0 && tp32.tv_sec > 0)
+      if (r == 0 && tp32.tv_sec >= 0)
 	{
 	  *tp = valid_timespec_to_timespec64 (tp32);
 	  return 0;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-21 12:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-21 12:49 [glibc] Linux: Fix 32-bit vDSO for clock_gettime on powerpc32 Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).