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=-4.1 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 AE41B1F461 for ; Thu, 4 Jul 2019 08:13:28 +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=fynnj Tq2S4aEVpIB9db7h6jrV4WuewCY41bXkTNJQTxkSuixq77C60ucAUyn3fC6Ohbo1 mPxSvIxLAn2/f98lnj+wOLHXKxlzNoUww8067VTrPLgSY3shjogzMv1V476tqBo3 Lja5MxYch00WmN9dm/vIXFQYQmjb6B0i3BUVHs= 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=RBGmioJqjBc 966+At1cru4CNIkc=; b=DkBUvjtF9f6m1YRTxrUcsdeTkRb7R+DCpJ8R2lZZ2zP 6EJkr192pM1Dgmo+mXozwNdrjj2UY6Kg29ccWxIjJP/rKMr7zaKXtoBMbJylGQyM vrs02s1ZCqNpL20rn1BdiooQn3iuz9blKc6thyGaZEf6xs8MkpefUp7vydHqaT9U = Received: (qmail 112121 invoked by alias); 4 Jul 2019 08:13:26 -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 112113 invoked by uid 89); 4 Jul 2019 08:13:26 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mail-out.m-online.net Date: Thu, 4 Jul 2019 10:13:18 +0200 From: Lukasz Majewski To: Alistair Francis Cc: Arnd Bergmann , Joseph Myers , Alistair Francis , GNU C Library , Adhemerval Zanella , Florian Weimer , Palmer Dabbelt , macro@wdc.com, Zong Li , Zong Li Subject: Re: [RFC v2 03/20] y2038: linux: Provide __clock_settime64 implementation Message-ID: <20190704101318.5493f9d3@jawa> In-Reply-To: References: <20190625175125.03375ead@jawa> <20190626110711.64e8cd2f@jawa> <20190626170344.2c9d1d47@jawa> <20190627005517.418d26c2@jawa> <20190627123557.01356d4d@jawa> <20190627160758.6fe824cf@jawa> <20190627172333.1a979f6d@jawa> <20190627181654.1d08392a@jawa> <20190628000805.65b6dfc9@jawa> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/UG3PvlFX6wuXDqQF_3G87QW"; protocol="application/pgp-signature" --Sig_/UG3PvlFX6wuXDqQF_3G87QW Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Alistair, > On Thu, Jun 27, 2019 at 3:08 PM Lukasz Majewski wrote: > > > > Hi Arnd, > > =20 > > > On Thu, Jun 27, 2019 at 6:17 PM Lukasz Majewski > > > wrote:=20 > > > > > > > > > > Ok, so you redirect both __clock_settime64 to __clock_settime > > > > > and __NR_settime64 to __NR_settime, in order to get back to > > > > > the same definition that you have today on 64-bit. > > > > > > > > > > Sorry for taking so long to understand that. =20 > > > > > > > > Not only you had a hard time to understand it. =20 > > > > > > Here is how I had imagined it would be done in a way that I find > > > easier to understand: > > > > > > #if __WORDSIZE =3D=3D 32 /* yes, all of them including rv32 and x32 */ > > > __clock_settime64 (clockid_t clock_id, const struct __timespec64 > > > *tp) { > > > int ret; > > > > > > /* Make sure the time cvalue is OK. */ > > > if (tp->tv_nsec < 0 || tp->tv_nsec >=3D 1000000000) > > > { > > > __set_errno (EINVAL); > > > return -1; > > > } > > > #ifdef __NR_clock_settime64 > > > ret =3D INLINE_SYSCALL_CALL (clock_settime64, clock_id, tp); > > > #endif > > > > > > #ifndef __ASSUME_TIME64_SYSCALLS > > > if (ret =3D=3D 0 || errno !=3D ENOSYS) > > > return ret; > > > > > > if (! in_time_t_range (tp->tv_sec)) > > > { > > > __set_errno (EOVERFLOW); > > > return -1; > > > } > > > > > > struct timespec ts32; > > > valid_timespec64_to_timespec (tp, &ts32); > > > ret =3D INLINE_SYSCALL_CALL (clock_settime, clock_id, &ts32); > > > #endif > > > > > > return ret; > > > } > > > #endif > > > > > > This should be functionally identical to what you have, but avoid > > > some of the complexity, especially once linux-5.1 becomes the > > > minimum version. =20 >=20 > This implementation looks good to me. It shouldn't be too hard to > extend this to all the problematic y2038 syscalls. This is the plan. After we agree on __ASSUME_TIME64_SYSCALLS semantics (the other patch - I've add you to CC on the ping for it) it shall be possible to follow a similar pattern as for __clock_settime for other syscalls. >=20 > > > > The semantics for __ASSUME_TIME64_SYSCALLS is under the discussion > > for some time [1]. =20 >=20 > I don't see any comments on this, do you know the status? I'm waiting for Joseph's (and the community) review and final acceptance (pulling to main tree).=20 >=20 > > > > Also the __clock_settime64() implementation from [2] takes into > > account some corner cases (like support for all archs since 3.2 > > kernel, x32, legacy systems, etc). The implementation from [2] IMHO > > seems to be more concise and fits into the 64 bit conversion > > paradigm for glibc [3]. =20 >=20 > This one also works for RV32 :) Good :-). Nice to have some users and testers :-). >=20 > Alistair >=20 > > > > However, this is only my opinion and we shall wait for other > > community members to express their opinions. > > =20 > > > > > > Arnd =20 > > > > > > Note: > > > > [1] - https://patchwork.ozlabs.org/patch/1117100/ > > [2] - https://patchwork.ozlabs.org/patch/1107235/ > > [3] - > > https://www.gnu.org/software/libc/manual/html_mono/libc.html > > "D.2.1 64-bit time symbol handling in the GNU C Library" > > > > > > > > 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 =20 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_/UG3PvlFX6wuXDqQF_3G87QW Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEgAyFJ+N6uu6+XupJAR8vZIA0zr0FAl0dtR4ACgkQAR8vZIA0 zr1AWgf/fSB7Omwlzil1KHjh4IbPKUr7i8XkpdGRSHPCDt2AVcw0bEd+GQEIDi3i wugwXik0aWVJ8GkTWviVEmD4BVuHyNducZlV5bL4jGjYZKZRb0FdAVUsWdcoXuFx KF8wOzJo41U1u3tOGGB6bj88vjsDsdKboX/FI/yHwgJjajA00qK0Gn/3FZbium2S 3itfAWtZSNPoaa8wBiAjSA5sN6EmXLG7t9K4C0+ot05VEV/RoNjHe+Drgop2+3AY B8iRSltidYAPwx4TtI4uquJDsbXu7jsfcczL+qsnDsycSNx1qrWrBvuds8JSTWxK ca3LYzIrRST0M1967+tnXp3kIHzYNg== =Cgd0 -----END PGP SIGNATURE----- --Sig_/UG3PvlFX6wuXDqQF_3G87QW--