Message ID | 20200426133110.5312-8-lukma@denx.de |
---|---|
State | New |
Headers | show |
Series | y2038: Convert clock_adjtime related syscalls to support 64 bit time | expand |
On 26/04/2020 10:31, Lukasz Majewski wrote: > @@ -69,6 +70,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; Why does it need the extra reserved fields? > +}; > # endif > > /* Convert a known valid struct timex into a struct __timex64. */ >
Hi Adhemerval, > On 26/04/2020 10:31, Lukasz Majewski wrote: > > @@ -69,6 +70,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; > > Why does it need the extra reserved fields? I've followed the definition of in-glibc ntptimeval definition in sysdeps/unix/sysv/linux/sys/timex.h As the __ntptimeval64 is not passed to the kernel (it gets its values based on struct __timex64), IMHO it would be safe to remove them. > > > +}; > > # endif > > > > /* Convert a known valid struct timex into a struct __timex64. */ > > 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
Hi Adhemerval, > Hi Adhemerval, > > > On 26/04/2020 10:31, Lukasz Majewski wrote: > > > @@ -69,6 +70,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; > > > > Why does it need the extra reserved fields? > > I've followed the definition of in-glibc ntptimeval definition in > sysdeps/unix/sysv/linux/sys/timex.h > > As the __ntptimeval64 is not passed to the kernel (it gets its values > based on struct __timex64), IMHO it would be safe to remove them. Those fields are present and cleared in the legacy ntptimeval structure exported to user programs. To avoid any odd regressions (who knows how this is used in the legacy code) and to facilitate the conversion to 64 bit time - I do think that the new struct __ntptimeval64 shall have those as well. > > > > > > +}; > > > # endif > > > > > > /* Convert a known valid struct timex into a struct __timex64. > > > */ > > > > > 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 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
diff --git a/sysdeps/unix/sysv/linux/include/sys/timex.h b/sysdeps/unix/sysv/linux/include/sys/timex.h index fdfffe2f3a..73c9addb3e 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 @@ -69,6 +70,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. */