diff mbox series

[v2,4/7] y2038: Introduce struct __ntptimeval64 - new internal glibc type

Message ID 20200508145640.16336-5-lukma@denx.de
State Committed
Commit df4289508a3a0e345a87544ee4eea8cbb4c9d197
Headers show
Series y2038: Convert clock_adjtime related syscalls to support 64 bit time | expand

Commit Message

Lukasz Majewski May 8, 2020, 2:56 p.m. UTC
This type is a glibc's "internal" type to get time parameters data from
Linux kernel (NTP daemon interface). It stores time in struct __timeval64
rather than struct timeval, which makes it Y2038-proof.

Build tests:
./src/scripts/build-many-glibcs.py glibcs
---
 sysdeps/unix/sysv/linux/include/sys/timex.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Adhemerval Zanella May 19, 2020, 7:10 p.m. UTC | #1
On 08/05/2020 11:56, Lukasz Majewski wrote:
> This type is a glibc's "internal" type to get time parameters data from
> Linux kernel (NTP daemon interface). 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, thanks.

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

> ---
>  sysdeps/unix/sysv/linux/include/sys/timex.h | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/sysdeps/unix/sysv/linux/include/sys/timex.h b/sysdeps/unix/sysv/linux/include/sys/timex.h
> index cf3059f63c..8c536b9a95 100644
> --- a/sysdeps/unix/sysv/linux/include/sys/timex.h
> +++ b/sysdeps/unix/sysv/linux/include/sys/timex.h
> @@ -32,6 +32,7 @@ libc_hidden_proto (__adjtimex)
>  #   define __timex64 timex
>  #   define __clock_adjtime64 __clock_adjtime
>  #   define ___adjtimex64 ___adjtimex
> +#   define __ntptimeval64 ntptimeval
>  #  else
>  
>  struct __timex64
> @@ -77,6 +78,19 @@ extern int __clock_adjtime64 (const clockid_t clock_id, struct __timex64 *tx64);
>  libc_hidden_proto (__clock_adjtime64);
>  extern int ___adjtimex64 (struct __timex64 *tx64);
>  libc_hidden_proto (___adjtimex64)
> +
> +struct __ntptimeval64
> +{
> +  struct __timeval64 time;	/* current time (ro) */
> +  long int maxerror;	/* maximum error (us) (ro) */
> +  long int esterror;	/* estimated error (us) (ro) */
> +  long int tai;		/* TAI offset (ro) */
> +
> +  long int __glibc_reserved1;
> +  long int __glibc_reserved2;
> +  long int __glibc_reserved3;
> +  long int __glibc_reserved4;
> +};
>  #  endif
>  
>  /* Convert a known valid struct timex into a struct __timex64.  */
>
diff mbox series

Patch

diff --git a/sysdeps/unix/sysv/linux/include/sys/timex.h b/sysdeps/unix/sysv/linux/include/sys/timex.h
index cf3059f63c..8c536b9a95 100644
--- a/sysdeps/unix/sysv/linux/include/sys/timex.h
+++ b/sysdeps/unix/sysv/linux/include/sys/timex.h
@@ -32,6 +32,7 @@  libc_hidden_proto (__adjtimex)
 #   define __timex64 timex
 #   define __clock_adjtime64 __clock_adjtime
 #   define ___adjtimex64 ___adjtimex
+#   define __ntptimeval64 ntptimeval
 #  else
 
 struct __timex64
@@ -77,6 +78,19 @@  extern int __clock_adjtime64 (const clockid_t clock_id, struct __timex64 *tx64);
 libc_hidden_proto (__clock_adjtime64);
 extern int ___adjtimex64 (struct __timex64 *tx64);
 libc_hidden_proto (___adjtimex64)
+
+struct __ntptimeval64
+{
+  struct __timeval64 time;	/* current time (ro) */
+  long int maxerror;	/* maximum error (us) (ro) */
+  long int esterror;	/* estimated error (us) (ro) */
+  long int tai;		/* TAI offset (ro) */
+
+  long int __glibc_reserved1;
+  long int __glibc_reserved2;
+  long int __glibc_reserved3;
+  long int __glibc_reserved4;
+};
 #  endif
 
 /* Convert a known valid struct timex into a struct __timex64.  */