public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Lukasz Majewski <lukma@denx.de>, Joseph Myers <joseph@codesourcery.com>
Cc: Alistair Francis <alistair23@gmail.com>,
	Alistair Francis <alistair.francis@wdc.com>,
	GNU C Library <libc-alpha@sourceware.org>,
	Florian Weimer <fweimer@redhat.com>,
	Andreas Schwab <schwab@suse.de>
Subject: Re: [PATCH 02/10] y2038: Introduce struct __timex64 - new internal glibc type
Date: Tue, 28 Apr 2020 11:34:07 -0300	[thread overview]
Message-ID: <3553694e-9870-ebd8-01b2-486a7dfbe74d@linaro.org> (raw)
In-Reply-To: <20200426133110.5312-3-lukma@denx.de>



On 26/04/2020 10:31, 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

LGTM, with just two nits about code formatting and and type specification.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  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 <struct___timeval64.h>
> +/* 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;

Not sure which is the code guidelines for unnamed bit fields, indent
places one field per line:

  [...]   
  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 */
> 

Use 'long long int' instead of 'long long'.

  parent reply	other threads:[~2020-04-28 14:34 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-26 13:31 [PATCH 00/10] y2038: Convert clock_adjtime related syscalls to support 64 bit time Lukasz Majewski
2020-04-26 13:31 ` [PATCH 01/10] y2038: include: Move struct __timeval64 definition to a separate file Lukasz Majewski
2020-04-27 15:18   ` Alistair Francis
2020-04-28 14:24   ` Adhemerval Zanella
2020-04-26 13:31 ` [PATCH 02/10] y2038: Introduce struct __timex64 - new internal glibc type Lukasz Majewski
2020-04-27 15:22   ` Alistair Francis
2020-04-28 14:34   ` Adhemerval Zanella [this message]
2020-04-29 21:45     ` Lukasz Majewski
2020-04-26 13:31 ` [PATCH 03/10] y2038: Provide conversion helpers for struct __timex64 Lukasz Majewski
2020-04-27 15:22   ` Alistair Francis
2020-04-28 15:56   ` Adhemerval Zanella
2020-04-26 13:31 ` [PATCH 04/10] y2038: linux: Provide __clock_adjtime64 implementation Lukasz Majewski
2020-04-27 22:12   ` Alistair Francis
2020-04-28 17:00   ` Adhemerval Zanella
2020-04-29 21:43     ` Lukasz Majewski
2020-04-26 13:31 ` [PATCH 05/10] y2038: linux: Provide ___adjtimex64 implementation Lukasz Majewski
2020-04-27 22:12   ` Alistair Francis
2020-04-28 17:14   ` Adhemerval Zanella
2020-04-26 13:31 ` [PATCH 06/10] y2038: linux: Provide __adjtime64 implementation Lukasz Majewski
2020-04-27 22:14   ` Alistair Francis
2020-04-28 18:33   ` Adhemerval Zanella
2020-04-26 13:31 ` [PATCH 07/10] y2038: Introduce struct __ntptimeval64 - new internal glibc type Lukasz Majewski
2020-04-28 18:41   ` Adhemerval Zanella
2020-04-29 21:28     ` Lukasz Majewski
2020-05-07 18:32       ` Lukasz Majewski
2020-04-26 13:31 ` [PATCH 08/10] y2038: Provide conversion helpers for struct __ntptimeval64 Lukasz Majewski
2020-04-26 13:31 ` [PATCH 09/10] y2038: linux: Provide __ntp_gettime64 implementation Lukasz Majewski
2020-04-26 13:31 ` [PATCH 10/10] y2038: linux: Provide __ntp_gettimex64 implementation Lukasz Majewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3553694e-9870-ebd8-01b2-486a7dfbe74d@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=alistair.francis@wdc.com \
    --cc=alistair23@gmail.com \
    --cc=fweimer@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --cc=lukma@denx.de \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).