From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by sourceware.org (Postfix) with ESMTPS id 79E3F388700F for ; Mon, 4 May 2020 15:32:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 79E3F388700F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=lukma@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 49G6L5174Kz1r8Qm; Mon, 4 May 2020 17:32:29 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 49G6L4718nz1qqlC; Mon, 4 May 2020 17:32:28 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id M8OLf1c7_JwO; Mon, 4 May 2020 17:32:27 +0200 (CEST) X-Auth-Info: 1r+neIbu64uYP98MQz5Bvd0RICIUoloBCXimwVyDmpc= Received: from jawa (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 4 May 2020 17:32:27 +0200 (CEST) Date: Mon, 4 May 2020 17:32:26 +0200 From: Lukasz Majewski To: Adhemerval Zanella Cc: Joseph Myers , Alistair Francis , Alistair Francis , GNU C Library , Florian Weimer , Andreas Schwab Subject: Re: [PATCH v2 5/5] y2038: Replace __clock_gettime with __clock_gettime64 Message-ID: <20200504173226.6f64396d@jawa> In-Reply-To: <5c01ae5f-bdb3-f683-8074-f3186ba1553a@linaro.org> References: <20200326080641.10193-1-lukma@denx.de> <20200326080641.10193-6-lukma@denx.de> <20200501135635.5178fd29@jawa> <5c01ae5f-bdb3-f683-8074-f3186ba1553a@linaro.org> Organization: denx.de X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/SU0H2LVIuJ=pIDPKm76yaye"; protocol="application/pgp-signature" X-Spam-Status: No, score=-24.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_NUMSUBJECT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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: Mon, 04 May 2020 15:32:32 -0000 --Sig_/SU0H2LVIuJ=pIDPKm76yaye Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Adhemerval, > On 01/05/2020 08:56, Lukasz Majewski wrote: > > Hi Adhemerval, > > =20 > >> On 26/03/2020 05:06, Lukasz Majewski wrote: =20 > >>> diff --git a/nis/nis_call.c b/nis/nis_call.c > >>> index 92c70e97aa..9c6f62a753 100644 > >>> --- a/nis/nis_call.c > >>> +++ b/nis/nis_call.c > >>> @@ -709,7 +709,7 @@ __nisfind_server (const_nis_name name, int > >>> search_parent, nis_error status; > >>> directory_obj *obj; > >>> struct timeval now; > >>> - struct timespec ts; > >>> + struct __timespec64 ts; > >>> unsigned int server_used =3D ~0; > >>> unsigned int current_ep =3D ~0; > >>> =20 > >>> @@ -719,8 +719,8 @@ __nisfind_server (const_nis_name name, int > >>> search_parent, if (*dir !=3D NULL) > >>> return NIS_SUCCESS; > >>> =20 > >>> - __clock_gettime (CLOCK_REALTIME, &ts); > >>> - TIMESPEC_TO_TIMEVAL (&now, &ts); > >>> + __clock_gettime64 (CLOCK_REALTIME, &ts); > >>> + now =3D valid_timespec64_to_timeval (ts); > >>> =20 > >>> if ((flags & NO_CACHE) =3D=3D 0) > >>> *dir =3D nis_server_cache_search (name, search_parent, > >>> &server_used, =20 > >> > >> I think it would be simpler to just remove the timeval argument on > >> nis_server_cache_search and move the __clock_gettime64 call on the > >> function start. =20 > >=20 > > Have I understood you correctly that you recommend removing the > > "now" struct timeval argument and then call explicitly > > __clock_gettime64 on the beginning of nis_server_cache_search > > function? =20 >=20 > Yes, the nis_server_cache_search is a static function used only once > at __nisfind_server. Ok. >=20 > > =20 > >> > >> Also, it would require to change nis_server_cache to use a > >> __time64_t for 'expires', otherwise this change won't help in > >> case of a time_t overflow. > >> =20 > >=20 > > Ok. I will update this. Thanks for pointing this out. > > =20 > >> =20 > >>> diff --git a/sysdeps/generic/hp-timing.h > >>> b/sysdeps/generic/hp-timing.h index e2d7447212..af9d92f7f7 100644 > >>> --- a/sysdeps/generic/hp-timing.h > >>> +++ b/sysdeps/generic/hp-timing.h > >>> @@ -34,8 +34,8 @@ typedef uint64_t hp_timing_t; > >>> vDSO symbol. */ > >>> #define HP_TIMING_NOW(var) \ > >>> ({ > >>> \ > >>> - struct timespec tv; > >>> \ > >>> - __clock_gettime (CLOCK_MONOTONIC, &tv); > >>> \ > >>> + struct __timespec64 tv; > >>> \ > >>> + __clock_gettime64 (CLOCK_MONOTONIC, &tv); > >>> \ (var) =3D (tv.tv_nsec + UINT64_C(1000000000) * tv.tv_sec); > >>> \ }) > >>> =20 > >> > >> Ok. > >> =20 > >>> diff --git a/sysdeps/generic/memusage.h > >>> b/sysdeps/generic/memusage.h index a111864b0b..91e56d24de 100644 > >>> --- a/sysdeps/generic/memusage.h > >>> +++ b/sysdeps/generic/memusage.h > >>> @@ -28,9 +28,9 @@ > >>> #ifndef GETTIME > >>> # define GETTIME(low,high) > >>> \ { > >>> \ > >>> - struct timespec now; > >>> \ > >>> + struct __timespec64 now; > >>> \ uint64_t usecs; > >>> \ > >>> - clock_gettime (CLOCK_REALTIME, &now); > >>> \ > >>> + __clock_gettime64 (CLOCK_REALTIME, &now); > >>> \ usecs =3D (uint64_t)now.tv_nsec / 1000 + > >>> (uint64_t)now.tv_sec * 1000000; \ low =3D usecs & 0xffffffff; > >>> \ high =3D usecs >> > >>> 32; \ > >>> =20 > >> > >> Is is the requirement to export __clock_gettime64 as a > >> GLIBC_PRIVATE symbol? > >> =20 > >=20 > > The __clock_gettime is already exported as GLIBC_PRIVATE at > > ./time/Versions, so I'm following this pattern. > >=20 > > Moreover, the glibc will not build when __clock_gettime64 is not > > exported. > > =20 > >> In any case, I think we should try to avoid use internal symbols > >> even for distributed glibc libraries, so I think this change > >> should go once we start to export the clock_gettime64 as default > >> symbol. =20 > >=20 > > Am I correct that this is a preprocessor macro, which is in the > > exported header? =20 >=20 > In fact __clock_gettime is used on other internal libraries and it > is required as is to avoid linknamespace pollution. So it seems > that __clock_gettime64 should follow the same logic. Ok, So then __clock_gettime64 shall be exported as well. >=20 > It might be misleading that for some ABI __clock_gettime and > for other __clock_gettime64 will be used internally, but it should > be ok nonetheless. >=20 All the occurrences of __clock_gettime shall be replaced by __clock_gettime64 internally in glibc as __clock_gettime64 is Y2038 safe for e.g. ARM32 and is aliased to __clock_gettime for 64 bit archs anyway. 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_/SU0H2LVIuJ=pIDPKm76yaye Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEgAyFJ+N6uu6+XupJAR8vZIA0zr0FAl6wNYoACgkQAR8vZIA0 zr0jPggAqezHa7TYsZcdrv0plBc+6v4tCgE+TnBGEVfRv6A6QiiwECJ02AHCuWaO VV0A7BiasjIncOvo6ALbhIINmM26SLpKFMj9w2gRVbr8p1TbRldSPPmCqkLr5d8q 1veszBaIQqJeQYn0VUvskzZZyI08q6FXjs2oAuVExBDatNBTrSTi0V8DDVBFhtFD SNjY2tIUIJhu6ymQHrOTyMKblK8sQu6qt8DRqFPNRQft2FJzXQoQk5qq4ZBvS3y2 s53k94iabosdW5X7GqItZ/+63DxENlhm4YYZeRUKsdfu6KooLdE7F3J78G9kClD/ xs/wKi0W18wzrE5bZ/z+EfugPFU15w== =zH84 -----END PGP SIGNATURE----- --Sig_/SU0H2LVIuJ=pIDPKm76yaye--