From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) by sourceware.org (Postfix) with ESMTPS id 124EC3870864 for ; Mon, 27 Apr 2020 15:30:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 124EC3870864 Received: by mail-il1-x143.google.com with SMTP id e8so17046912ilm.7 for ; Mon, 27 Apr 2020 08:30:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0E2Qnp7juQomBR7TFEyMjnPNlLSzUcu9+jvsjasgcS4=; b=slOPElhSum8/ZYyWH8AfPKO0zqukIaQ9AvWM2jeNY26jPyKKQfi1aXxF7UwV6JAXLz ljyVJNxXlIRy10ZWGp9UJkxCijYRq/zAAioKDfWjQJwIXpYocj5q439D39mOIvkuZUJ7 Rg+w0Z0oiAXpgy8C0R5c409sahLl/HG1L+n7e8JctX54Ydo9tIrd8k9lMbN3ifY/dX4v /Nhixt0iRy1qUEhHCCi72JrDNxabHAmYybUTz67D0VSxVsOL06/Vt4vkgZ1a/XgCjFMt aIwc7nx7Y5SoQlw/9ksj8dMED8BSOAS4zYl1c/08pyMxCxRKf2jaVgYujaZhL1gpTcSY lacg== X-Gm-Message-State: AGi0PuZ1DIXZwpNxmnKbu9xUk21vQo8eq5ifXg/3/s9PQD1Y4D+TFMdj /u6fNNGdCOe5JXiNa0dZssy4fVex41pZiAyiTpc= X-Google-Smtp-Source: APiQypJG+ctPiVBd9lVoTLWsEHtM9EvL8YpdP5n7HxtaPldnCKKhGd90PyKHKgsysXiGM3BFkiBk/fo3QjGnLk3paeo= X-Received: by 2002:a92:d0c6:: with SMTP id y6mr22872335ila.227.1588001442560; Mon, 27 Apr 2020 08:30:42 -0700 (PDT) MIME-Version: 1.0 References: <20200426133110.5312-1-lukma@denx.de> <20200426133110.5312-3-lukma@denx.de> In-Reply-To: <20200426133110.5312-3-lukma@denx.de> From: Alistair Francis Date: Mon, 27 Apr 2020 08:22:05 -0700 Message-ID: Subject: Re: [PATCH 02/10] y2038: Introduce struct __timex64 - new internal glibc type To: Lukasz Majewski Cc: Joseph Myers , Adhemerval Zanella , Alistair Francis , GNU C Library , Florian Weimer , Andreas Schwab Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-19.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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, 27 Apr 2020 15:30:53 -0000 On Sun, Apr 26, 2020 at 6:31 AM Lukasz Majewski wrote: > > The introduced glibc's 'internal' struct __timex64 is a copy of Linux kernel's > struct __kernel_timex (v5.6) introduced for properly handling data for > clock_adjtime64 syscall. > As the struct's __kernel_timex size is the same as for archs with > __WORDSIZE == 64, proper padding and data types conversion (i.e. long to long > long) had to be added for architectures with __WORDSIZE == 32 && > __TIMESIZE != 64. > > Moreover, it stores time in struct __timeval64 rather than struct > timeval, which makes it Y2038-proof. > > Build tests: > ./src/scripts/build-many-glibcs.py glibcs Reviewed-by: Alistair Francis Alistair > --- > sysdeps/unix/sysv/linux/include/sys/timex.h | 38 +++++++++++++++++++++ > 1 file changed, 38 insertions(+) > > diff --git a/sysdeps/unix/sysv/linux/include/sys/timex.h b/sysdeps/unix/sysv/linux/include/sys/timex.h > index 319d566608..f25081639b 100644 > --- a/sysdeps/unix/sysv/linux/include/sys/timex.h > +++ b/sysdeps/unix/sysv/linux/include/sys/timex.h > @@ -25,5 +25,43 @@ > > libc_hidden_proto (__adjtimex) > > +# include > +/* Local definition of 64 bit time supporting timex struct */ > +# if __TIMESIZE == 64 > +# define __timex64 timex > +# else > + > +struct __timex64 > +{ > + unsigned int modes; /* mode selector */ > + int :32; /* pad */ > + long long offset; /* time offset (usec) */ > + long long freq; /* frequency offset (scaled ppm) */ > + long long maxerror; /* maximum error (usec) */ > + long long esterror; /* estimated error (usec) */ > + int status; /* clock command/status */ > + int :32; /* pad */ > + long long constant; /* pll time constant */ > + long long precision; /* clock precision (usec) (read only) */ > + long long tolerance; /* clock frequency tolerance (ppm) (ro) */ > + struct __timeval64 time; /* (read only, except for ADJ_SETOFFSET) */ > + long long tick; /* (modified) usecs between clock ticks */ > + long long ppsfreq; /* pps frequency (scaled ppm) (ro) */ > + long long jitter; /* pps jitter (us) (ro) */ > + int shift; /* interval duration (s) (shift) (ro) */ > + int :32; /* pad */ > + long long stabil; /* pps stability (scaled ppm) (ro) */ > + long long jitcnt; /* jitter limit exceeded (ro) */ > + long long calcnt; /* calibration intervals (ro) */ > + long long errcnt; /* calibration errors (ro) */ > + long long stbcnt; /* stability limit exceeded (ro) */ > + > + int tai; /* TAI offset (ro) */ > + > + int :32; int :32; int :32; int :32; > + int :32; int :32; int :32; int :32; > + int :32; int :32; int :32; > +}; > +# endif > # endif /* _ISOMAC */ > #endif /* sys/timex.h */ > -- > 2.20.1 >