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 B7F6F1F463 for ; Wed, 27 Nov 2019 17:00:41 +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=o+XlI Fmzsh7R/S81BtKNmmaXMGAMJor28NbHu2I0+ZvjZVwPL9bkxCr2izRa5xlMOMdB8 vpjilOV0Vyl/15VbWUFYYwgpo+2ywIml+d9Wtyd246fKRWhu27dvDF5ZyVSrNHQd XnHJEkEnwohN/zHA+gN0ML6aYVcOVXUERmHiLE= 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=Up23pFc0nRF GGuotpLhNGA9ynYs=; b=FVAMm8NAxoYSjMxZZvudTk2B8bmswCao7dfsufgnIif Goe/niMlvep/cCXh7K5mmftO4ruWr6vRMUUFHW4CD3k/SIckMmFNfbbPAVZS2rYt xl4mjx6vs3cRF0MAAKt+bTiBZmCQlB9HyCegCRkaBnBDUpLU2exUjEiplB1UwbtQ = Received: (qmail 74274 invoked by alias); 27 Nov 2019 17:00:38 -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 74131 invoked by uid 89); 27 Nov 2019 17:00:28 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mail-out.m-online.net Date: Wed, 27 Nov 2019 18:00:09 +0100 From: Lukasz Majewski To: Joseph Myers , Paul Eggert Cc: Alistair Francis , Alistair Francis , GNU C Library , Adhemerval Zanella , Florian Weimer , Florian Weimer , Zack Weinberg , Carlos O'Donell Subject: Re: [PATCH 4/5] y2038: linux: Provide __timer_gettime64 implementation Message-ID: <20191127180009.402490c7@jawa> In-Reply-To: <20191111214758.3677-5-lukma@denx.de> References: <20191111214758.3677-1-lukma@denx.de> <20191111214758.3677-5-lukma@denx.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/Js/Mh40jJAO2nicjHD0TMbT"; protocol="application/pgp-signature" --Sig_/Js/Mh40jJAO2nicjHD0TMbT Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Dear All, > This patch provides new __timer_gettime64 explicit 64 bit function > for reading status of specified timer. To be more precise - the > remaining time and interval set with timer_settime. > Moreover, a 32 bit version - __timer_gettime has been refactored to > internally use __timer_gettime64. >=20 > The __timer_gettime is now supposed to be used on systems still > supporting 32 bit time (__TIMESIZE !=3D 64) - hence the necessary > conversion from 64 bit struct __timespec64 to struct timespec. >=20 > The new __timer_gettime64 syscall available from Linux 5.1+ has been > used, when applicable. >=20 > Build tests: > - The code has been tested on x86_64/x86 (native compilation): > make PARALLELMFLAGS=3D"-j8" && make check PARALLELMFLAGS=3D"-j8" && \\ > make xcheck PARALLELMFLAGS=3D"-j8" >=20 > - The glibc has been build tested (make PARALLELMFLAGS=3D"-j8") for > x86 (i386), x86_64-x32, and armv7 >=20 > Run-time tests: > - Run specific tests on ARM/x86 32bit systems (qemu): > https://github.com/lmajewski/meta-y2038 and run tests: > https://github.com/lmajewski/y2038-tests/commits/master >=20 > - Use of cross-test-ssh.sh for ARM (armv7): > make PARALLELMFLAGS=3D"-j8" test-wrapper=3D'./cross-test-ssh.sh > root@192.168.7.2' xcheck >=20 > Linux kernel, headers and minimal kernel version for glibc build test > matrix: > - Linux v5.1 (with timer_gettime64) and glibc build with v5.1 as > minimal kernel version (--enable-kernel=3D"5.1.0") > The __ASSUME_TIME64_SYSCALLS flag defined. >=20 > - Linux v5.1 and default minimal kernel version > The __ASSUME_TIME64_SYSCALLS not defined, but kernel supports > timer_gettime64 syscall. >=20 > - Linux v4.19 (no timer_gettime64 support) with default minimal > kernel version for contemporary glibc (3.2.0) > This kernel doesn't support timer_gettime64 syscall, so the > fallback to timer_gettime is tested. >=20 > Above tests were performed with Y2038 redirection applied as well as > without (so the __TIMESIZE !=3D 64 execution path is checked as well). >=20 > No regressions were observed. > --- > include/time.h | 7 ++++ > sysdeps/unix/sysv/linux/timer_gettime.c | 44 > ++++++++++++++++++++++--- 2 files changed, 47 insertions(+), 4 > deletions(-) >=20 > diff --git a/include/time.h b/include/time.h > index 52ee213669..8b9a4b7a60 100644 > --- a/include/time.h > +++ b/include/time.h > @@ -179,6 +179,13 @@ extern int __futimens64 (int fd, const struct > __timespec64 tsp[2]); libc_hidden_proto (__futimens64); > #endif > =20 > +#if __TIMESIZE =3D=3D 64 > +# define __timer_gettime64 __timer_gettime > +#else > +extern int __timer_gettime64 (timer_t timerid, struct __itimerspec64 > *value); +libc_hidden_proto (__timer_gettime64); > +#endif > + > /* Compute the `struct tm' representation of T, > offset OFFSET seconds east of UTC, > and store year, yday, mon, mday, wday, hour, min, sec into *TP. > diff --git a/sysdeps/unix/sysv/linux/timer_gettime.c > b/sysdeps/unix/sysv/linux/timer_gettime.c index > 8d9bef9196..31bf5ce25b 100644 --- > a/sysdeps/unix/sysv/linux/timer_gettime.c +++ > b/sysdeps/unix/sysv/linux/timer_gettime.c @@ -20,15 +20,51 @@ > #include > #include > #include > +#include > #include "kernel-posix-timers.h" > =20 > int > -timer_gettime (timer_t timerid, struct itimerspec *value) > +__timer_gettime64 (timer_t timerid, struct __itimerspec64 *value) > { > struct timer *kt =3D (struct timer *) timerid; > =20 > - /* Delete the kernel timer object. */ > - int res =3D INLINE_SYSCALL (timer_gettime, 2, kt->ktimerid, value); > +#ifdef __ASSUME_TIME64_SYSCALLS > +# ifndef __NR_timer_gettime64 > +# define __NR_timer_gettime64 __NR_timer_gettime > +# endif > + return INLINE_SYSCALL (timer_gettime64, 2, kt->ktimerid, value); > +#else > +# ifdef __NR_timer_gettime64 > + int ret =3D INLINE_SYSCALL (timer_gettime64, 2, kt->ktimerid, value); > + if (ret =3D=3D 0 || errno !=3D ENOSYS) > + return ret; > +# endif > + struct itimerspec its32; > + int retval =3D INLINE_SYSCALL (timer_gettime, 2, kt->ktimerid, > &its32); > + if (! retval) > + { > + value->it_interval =3D valid_timespec_to_timespec64 > (its32.it_interval); > + value->it_value =3D valid_timespec_to_timespec64 > (its32.it_value); > + } > =20 > - return res; > + return retval; > +#endif > } > + > +#if __TIMESIZE !=3D 64 > +int > +__timer_gettime (timer_t timerid, struct itimerspec *value) > +{ > + struct __itimerspec64 its64; > + int retval =3D __timer_gettime64 (timerid, &its64); > + if (! retval) > + { > + value->it_interval =3D valid_timespec64_to_timespec > (its64.it_interval); > + value->it_value =3D valid_timespec64_to_timespec > (its64.it_value); > + } > + > + return retval; > +} > +#endif > +weak_alias (__timer_gettime, timer_gettime) > +libc_hidden_def (timer_gettime) Gentle ping, 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_/Js/Mh40jJAO2nicjHD0TMbT Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEgAyFJ+N6uu6+XupJAR8vZIA0zr0FAl3eq5kACgkQAR8vZIA0 zr3YeggAmA1HwA/kXmbSxzsYLKolLyT3TvOzh9419T6gEZNtQpLS9SNH01q4Rg08 xmi3K11SLy7rbHzwgDcf0Fbz7X1i60Cpa3E5o3JiKRWeVzyR3l5vQQ6fl0WB3IWd fyWyGuutyyG01wWNWjjsuLfclf+5qYTyen0R6kka5jMBH0YvK4HVj6Sqwbp0Q3x2 URnj9DwOuFtK8uTAz+hHN3Bpmnkl7zaoKkXfk1UC8N2S9kOTgnGKtCIK5zaMiQgt jitORt3MqQqLu/slrFahK+80zAPaE3eXg1q9ZNDIyHL8OKy+kUkeIB+92kD/xvgf CPbGH6YPee6PQ/jOUInpeF1Gf5fMgQ== =IDQX -----END PGP SIGNATURE----- --Sig_/Js/Mh40jJAO2nicjHD0TMbT--