From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id DA1971F461 for ; Wed, 17 Jul 2019 12:48:37 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-type; q=dns; s=default; b=fZnmw DTZuHiBo63cgtcUzZjTYu4qC/CB07AKbVCgyhX2cWxpd253XXK9BjcubFd8s5osi 8ba1gqKXWdtQsNas3ny/3wQBk1/3eaUx9OTP+R6kRlmgE+wF6ozKDizkZ+ZxJWgk K/dzU07gS9UMipPZwpwdtE2JP0oy7HQa/o/dP8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-type; s=default; bh=inkq58rMkpa 2Guj7aH/NGwhprzw=; b=It+IM+EtrIFSKGJuGZQl8+pxewpnI37/aXFfl6ImoO3 QwMc5boCU+2suVv8BxytEINhJ0rqX+vUTAAPukTRsDDOV+xFG1Q1157e02r3o+BD dokLjNRzUcmbymX6WaHatp84U9+YGgR3kBo20WecHPJ9qoWO6jAIoRBGQ2X7zUpY = Received: (qmail 37939 invoked by alias); 17 Jul 2019 12:48:35 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 37931 invoked by uid 89); 17 Jul 2019 12:48:35 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mail-out.m-online.net Date: Wed, 17 Jul 2019 14:48:28 +0200 From: Lukasz Majewski To: Alistair Francis Cc: libc-alpha@sourceware.org, arnd@arndb.de, adhemerval.zanella@linaro.org, fweimer@redhat.com, palmer@sifive.com, macro@wdc.com, zongbox@gmail.com, alistair23@gmail.com, Wolfgang Denk , Joseph Myers Subject: Re: [RFC v3 02/23] sysdeps/gettimeofday: Use clock_gettime64 if avaliable Message-ID: <20190717144828.21a559ec@jawa> In-Reply-To: <20190717144305.3eda6678@jawa> References: <20190717144305.3eda6678@jawa> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/3yZuURBxzJkKoGZ3rRWYNkq"; protocol="application/pgp-signature" --Sig_/3yZuURBxzJkKoGZ3rRWYNkq Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi, > Hi Alistair, >=20 > > Not all architectures support the obsolete gettimeofday so use the > > newer clock_gettime64 syscall if it is avaliable. This fixes RV32 > > build issues. > >=20 > > Signed-off-by: Alistair Francis > > --- > > ChangeLog | 1 + > > sysdeps/unix/sysv/linux/gettimeofday.c | 28 > > ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) > >=20 > > diff --git a/ChangeLog b/ChangeLog > > index 477b9b49b3..9ca390a9c3 100644 > > --- a/ChangeLog > > +++ b/ChangeLog > > @@ -1028,6 +1028,7 @@ > > * nptl/thrd_sleep.c: Use clock_nanosleep_time64 instead of > > nanosleep. > > * sysdeps/unix/sysv/linux/nanosleep.c: Likewise. > > * sysdeps/unix/sysv/linux/nanosleep_nocancel.c: Likewise. > > + * sysdeps/unix/sysv/linux/gettimeofday.c: Use > > clock_gettime64 syscall for gettimeofday.=20 > > 2019-06-20 Dmitry V. Levin > > Florian Weimer > > diff --git a/sysdeps/unix/sysv/linux/gettimeofday.c > > b/sysdeps/unix/sysv/linux/gettimeofday.c index > > a74f03825a..151b1e606c 100644 --- > > a/sysdeps/unix/sysv/linux/gettimeofday.c +++ > > b/sysdeps/unix/sysv/linux/gettimeofday.c @@ -32,7 +32,35 @@ > > int > > __gettimeofday (struct timeval *tv, struct timezone *tz) > > { > > +#ifdef __ASSUME_TIME64_SYSCALLS =20 >=20 > I'm not the glibc expert but according to [1], the > __ASSUME_TIME64_SYSCALLS will be defined also for __WORDSIZE =3D 64 > archs. >=20 > This means that this code will be executed on x86_64 and return with > an ENOTSUPP error as those archs shall not define clock_gettime64 and ^^^^^^^ - sorry s/ENOTSUPP/ENOSYS/g > will just use the clock_settime. >=20 > Please consider re-using pattern from clock_settime conversion [2]. >=20 > > + int ret; > > + struct __timespec64 now; > > + > > + ret =3D INLINE_VSYSCALL (clock_gettime64, 2, CLOCK_REALTIME, > > + &now); > > + > > + /* Convert from timespec to timeval */ > > + tv->tv_sec =3D now.tv_sec; > > + tv->tv_usec =3D now.tv_nsec / 1000; > > + > > + return ret; > > +#else > > +# ifdef __NR_clock_gettime64 > > + long int ret; > > + struct __timespec64 now; > > + > > + ret =3D INLINE_VSYSCALL (clock_gettime64, 2, CLOCK_REALTIME, > > + &now); > > + > > + /* Convert from timespec to timeval */ > > + tv->tv_sec =3D now.tv_sec; > > + tv->tv_usec =3D now.tv_nsec / 1000; > > + > > + if (ret =3D=3D 0 || errno !=3D ENOSYS) > > + return ret; > > +# endif > > return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); > > +#endif > > } > > libc_hidden_def (__gettimeofday) > > weak_alias (__gettimeofday, gettimeofday) =20 >=20 > Note: >=20 > [1] -=20 > https://github.com/lmajewski/y2038_glibc/commit/1fdbc6002101a78a8a6a076bb= b642b3082c2225d >=20 > [2] - > https://github.com/lmajewski/y2038_glibc/commit/69f842a8519ca13ed11fab0ff= 1bcc6fa1a524192 >=20 > Best regards, >=20 > Lukasz Majewski >=20 > -- >=20 > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: > lukma@denx.de Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de --Sig_/3yZuURBxzJkKoGZ3rRWYNkq Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEgAyFJ+N6uu6+XupJAR8vZIA0zr0FAl0vGRwACgkQAR8vZIA0 zr2ftQf/S7yBDoLK04hg25sPcVPtGKmzVM6emZyQZJi9mgzRj72G51hJUKlUCEd4 1NF/ynvD1LZFW9k0/ph6et8VjMRLdk7qppHYNGaB3T7ir6b5lN7OZ0iZybaopARx iWbG+OH+e0qbq3QWLoan1SOqe0Z6RKRXmL8q663SfgIY9Wg4idrDgBlTs/KzWA0o 2PfWqps9zBPU4+16naXS9JpOdFJge8OCmJXYSYW/EnDjym24rlGOMmLEvDuqw3e0 kgqq5cfba64lD88e1aIdH7qOpbV102M9QNvANbAxmTxXxJDMreykpXpt9pnWDcg7 VlE11O5jd/KzpZkbG5DqJNEQvE4q/w== =QBPY -----END PGP SIGNATURE----- --Sig_/3yZuURBxzJkKoGZ3rRWYNkq--