From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by sourceware.org (Postfix) with ESMTPS id 5B5403857C5B for ; Thu, 10 Sep 2020 19:31:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5B5403857C5B Received: by mail-il1-x142.google.com with SMTP id y2so6840348ilp.7 for ; Thu, 10 Sep 2020 12:31:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lN5XtBzTnp52gPeJ9XYMs0Dj53QY7JhGiQOCzeNdQHc=; b=BBH6c7NUR0/fCu3RkeudbWQC5tRYfm7PlSHemX/Iozk4p6Dj5B8wXsYE1LeXwpBdyQ u4BZBOCPk+HEq/skFIz/UvjNMNso6IC4qUeDZY2jcZUZ3IGrv+DYDwL1x4GVe9ysAkt+ l/zBfp+nId2azP7+8eZMvR/H7rRUcN66YJPmnDekFkDR0c6qMXmLzATgJ9OraN67WRX5 NltPwQEz/dzbYTb2p6jk9bGZUIZjHsa+vlmMj91WYFZwXCnaYyzCZJiwfNE2zb7Zdwlb Q2iRMAQ/VNNjE14OnWBsS2xM5rV5jUlbbvQoNVI5aEoPCyqeqQBcTvsww0It2gsmPR4n eHfg== X-Gm-Message-State: AOAM531IydJJpLhVedjsB9DeR4xxyl8ZQXeW9DWpzXs3U1EA78fNtKA6 qHxu+s5kOvxiw4G2xWLw0vVZ4dAk3h8NBNOsUXI= X-Google-Smtp-Source: ABdhPJwH0I6zrcs/2L1sf6crPtAzGGP8b+XVd9nCLubXyBwPLnUt53iB0TTeFYBFk/LYLSyc/c7E4Cbgpowr0I3VIPU= X-Received: by 2002:a05:6e02:ca3:: with SMTP id 3mr9931272ilg.227.1599766290748; Thu, 10 Sep 2020 12:31:30 -0700 (PDT) MIME-Version: 1.0 References: <20200908145738.640039-1-adhemerval.zanella@linaro.org> In-Reply-To: <20200908145738.640039-1-adhemerval.zanella@linaro.org> From: Alistair Francis Date: Thu, 10 Sep 2020 12:20:29 -0700 Message-ID: Subject: Re: [PATCH v2 01/14] linux: Simplify clock_getres To: Adhemerval Zanella Cc: GNU C Library Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2020 19:31:32 -0000 On Tue, Sep 8, 2020 at 7:57 AM Adhemerval Zanella via Libc-alpha wrote: > > With arch-syscall.h it can now assumes the existance of either > __NR_clock_getres or __NR_clock_getres_time64. The 32-bit time_t > support is now only build for !__ASSUME_TIME64_SYSCALLS. > > It also uses the time64-support functions to simplify it further. > > Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15 > kernel). Reviewed-by: Alistair Francis Alistair > --- > sysdeps/unix/sysv/linux/clock_getres.c | 38 ++++++++++---------------- > 1 file changed, 15 insertions(+), 23 deletions(-) > > diff --git a/sysdeps/unix/sysv/linux/clock_getres.c b/sysdeps/unix/sysv/linux/clock_getres.c > index 5f6955ab10..6be73c94de 100644 > --- a/sysdeps/unix/sysv/linux/clock_getres.c > +++ b/sysdeps/unix/sysv/linux/clock_getres.c > @@ -21,6 +21,7 @@ > #include > > #include > +#include > #include > #include > > @@ -28,36 +29,26 @@ > int > __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. */ > -# 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 > - 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 > - /* Avoid issue a __NR_clock_getres_time64 syscall on kernels that do not > - support 64-bit time_t. */ > - static int time64_support = 1; > - if (atomic_load_relaxed (&time64_support) != 0) > + > +#ifndef __NR_clock_getres_time64 > +# define __NR_clock_getres_time64 __NR_clock_getres > +#endif > + if (supports_time64 ()) > { > -# ifdef HAVE_CLOCK_GETRES64_VSYSCALL > +#ifdef HAVE_CLOCK_GETRES64_VSYSCALL > r = INLINE_VSYSCALL (clock_getres_time64, 2, clock_id, res); > -# else > +#else > r = INLINE_SYSCALL_CALL (clock_getres_time64, clock_id, res); > -# endif > +#endif > + > if (r == 0 || errno != ENOSYS) > return r; > > - atomic_store_relaxed (&time64_support, 0); > + mark_time64_unsupported (); > } > -# endif > + > +#ifndef __ASSUME_TIME64_SYSCALLS > /* Fallback code that uses 32-bit support. */ > struct timespec ts32; > # ifdef HAVE_CLOCK_GETRES_VSYSCALL > @@ -67,8 +58,9 @@ __clock_getres64 (clockid_t clock_id, struct __timespec64 *res) > # endif > if (r == 0) > *res = valid_timespec_to_timespec64 (ts32); > - return r; > #endif > + > + return r; > } > > #if __TIMESIZE != 64 > -- > 2.25.1 >