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 054F21F463 for ; Wed, 27 Nov 2019 17:00:49 +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=tHFQp 3ylGGtPwzWy4KD+5nDJ8hEafNbmmdYCfZPKNQ81KRaXeNoHyvgsfXCd/UUso6m6+ alf91ueDovf/sFkeegsyuo/AVlkSJD4M/HaCIevyo7/rpV/i70BI2Aw5CdTV99xi 7QOwhJHiU7zBJ2wo5gnkzw4y7J3P+hINMvh63o= 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=VkAb15crOAE zIes7oc7C1gN5LPk=; b=Lgbd3KN7dhm4shPUxTksAlfluingYe6z8wzDnPrpv35 4mUGVCT0ea8g+ACObmoINMwmxoJfdeUCsQeKGYRhKiZpvhtK7gBUYevC2S1PBI7c tacfUKsLhh6sDhn8vuf9snHlUyHNXSg20YTO5qP1xnLNNDiUNfY7nhflXs2xP9g0 = Received: (qmail 74309 invoked by alias); 27 Nov 2019 17:00:39 -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 74278 invoked by uid 89); 27 Nov 2019 17:00:38 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mail-out.m-online.net Date: Wed, 27 Nov 2019 18:00:30 +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 5/5] y2038: linux: Provide __timer_settime64 implementation Message-ID: <20191127180030.4320e088@jawa> In-Reply-To: <20191111214758.3677-6-lukma@denx.de> References: <20191111214758.3677-1-lukma@denx.de> <20191111214758.3677-6-lukma@denx.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/1JBgGTiISY=.8UB.KgPCF7U"; protocol="application/pgp-signature" --Sig_/1JBgGTiISY=.8UB.KgPCF7U Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Dear All, > This patch provides new __timer_settime64 explicit 64 bit function > for setting flags, interval and value of specified timer. > Moreover, a 32 bit version - __timer_settime has been refactored to > internally use __timer_settime64. >=20 > The __timer_settime is now supposed to be used on systems still > supporting 32 bit time (__TIMESIZE !=3D 64) - hence the necessary > conversion to 64 bit struct __timespec64 from struct timespec (and > opposite when old_value pointer is provided). >=20 > The new __timer_settime64 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_settime64) 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_settime64 syscall. >=20 > - Linux v4.19 (no timer_settime64 support) with default minimal > kernel version for contemporary glibc (3.2.0) > This kernel doesn't support timer_settime64 syscall, so the > fallback to timer_settime 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 | 9 ++++ > sysdeps/unix/sysv/linux/timer_settime.c | 68 > ++++++++++++++++++++++--- 2 files changed, 71 insertions(+), 6 > deletions(-) >=20 > diff --git a/include/time.h b/include/time.h > index 8b9a4b7a60..a46fd2f08a 100644 > --- a/include/time.h > +++ b/include/time.h > @@ -186,6 +186,15 @@ extern int __timer_gettime64 (timer_t timerid, > struct __itimerspec64 *value); libc_hidden_proto (__timer_gettime64); > #endif > =20 > +#if __TIMESIZE =3D=3D 64 > +# define __timer_settime64 __timer_settime > +#else > +extern int __timer_settime64 (timer_t timerid, int flags, > + const struct __itimerspec64 *value, > + struct __itimerspec64 *ovalue); > +libc_hidden_proto (__timer_settime64); > +#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_settime.c > b/sysdeps/unix/sysv/linux/timer_settime.c index > 51f24200aa..f847e3e44a 100644 --- > a/sysdeps/unix/sysv/linux/timer_settime.c +++ > b/sysdeps/unix/sysv/linux/timer_settime.c @@ -20,17 +20,73 @@ > #include > #include > #include > +#include > #include "kernel-posix-timers.h" > =20 > int > -timer_settime (timer_t timerid, int flags, const struct itimerspec > *value, > - struct itimerspec *ovalue) > +__timer_settime64 (timer_t timerid, int flags, > + const struct __itimerspec64 *value, > + struct __itimerspec64 *ovalue) > { > struct timer *kt =3D (struct timer *) timerid; > =20 > - /* Delete the kernel timer object. */ > - int res =3D INLINE_SYSCALL (timer_settime, 4, kt->ktimerid, flags, > - value, ovalue); > +#ifdef __ASSUME_TIME64_SYSCALLS > +# ifndef __NR_timer_settime64 > +# define __NR_timer_settime64 __NR_timer_settime > +# endif > + return INLINE_SYSCALL (timer_settime64, 4, kt->ktimerid, flags, > value, > + ovalue); > +#else > +# ifdef __NR_timer_settime64 > + int ret =3D INLINE_SYSCALL (timer_settime64, 4, kt->ktimerid, flags, > value, > + ovalue); > + if (ret =3D=3D 0 || errno !=3D ENOSYS) > + return ret; > +# endif > + struct itimerspec its32, oits32; > =20 > - return res; > + if (! in_time_t_range ((value->it_value).tv_sec) > + || ! in_time_t_range ((value->it_interval).tv_sec)) > + { > + __set_errno (EOVERFLOW); > + return -1; > + } > + > + its32.it_interval =3D valid_timespec64_to_timespec > (value->it_interval); > + its32.it_value =3D valid_timespec64_to_timespec (value->it_value); > + > + int retval =3D INLINE_SYSCALL (timer_settime, 4, kt->ktimerid, flags, > + &its32, ovalue ? &oits32 : NULL); > + if (! retval && ovalue) > + { > + ovalue->it_interval =3D valid_timespec_to_timespec64 > (oits32.it_interval); > + ovalue->it_value =3D valid_timespec_to_timespec64 > (oits32.it_value); > + } > + > + return retval; > +#endif > +} > + > +#if __TIMESIZE !=3D 64 > +int > +__timer_settime (timer_t timerid, int flags, const struct itimerspec > *value, > + struct itimerspec *ovalue) > +{ > + struct __itimerspec64 its64, oits64; > + int retval; > + > + its64.it_interval =3D valid_timespec_to_timespec64 > (value->it_interval); > + its64.it_value =3D valid_timespec_to_timespec64 (value->it_value); > + > + retval =3D __timer_settime64 (timerid, flags, &its64, ovalue ? > &oits64 : NULL); > + if (! retval && ovalue) > + { > + ovalue->it_interval =3D valid_timespec64_to_timespec > (oits64.it_interval); > + ovalue->it_value =3D valid_timespec64_to_timespec > (oits64.it_value); > + } > + > + return retval; > } > +#endif > +weak_alias (__timer_settime, timer_settime) > +libc_hidden_def (timer_settime) 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_/1JBgGTiISY=.8UB.KgPCF7U Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEgAyFJ+N6uu6+XupJAR8vZIA0zr0FAl3eq64ACgkQAR8vZIA0 zr3MAQgA4R4tjn0nU8d8krpX2WWFRg/X9IyK8Cq3se426QpfoEH5OdP+pPJiK6U/ HBahpA05eZEWi3vS8MIybyW92uqFYHT2bi05cqJvlj4IyKuEqEs43HlHoW0HsHP2 xDVYOq4+2jW7nwsSSxcv1FLSb8aheZus3sUU0S0smk++OIuDpbN1V86dZu9Uq8Or sfpA+LF2o54Jd9cD43Bg35A7oX3uhcIGRYy3t9nbhUdPJPCCyfNlI7cP/uB4e3cp xb3cAbn3sE2UybK+CYDSLlG4a956Cu+lYxpPHNeX/YYjGn75fi32JyUgzrn6hn1F sKGl6b5u/nZ0ao9/E70ASBOzYkprQQ== =M/B+ -----END PGP SIGNATURE----- --Sig_/1JBgGTiISY=.8UB.KgPCF7U--