[PATCH v3] y2038: Replace __clock_gettime with __clock_gettime64
H.J. Lu
hjl.tools@gmail.com
Thu May 21 11:11:15 GMT 2020
On Thu, May 21, 2020 at 3:24 AM Lukasz Majewski <lukma@denx.de> wrote:
>
> Hi "H.J. Lu",
>
> > On Tue, May 5, 2020 at 11:21 AM Lukasz Majewski <lukma@denx.de> wrote:
> > >
> > > The __clock_gettime internal function is not supporting 64 bit time
> > > on architectures with __WORDSIZE == 32 and __TIMESIZE != 64 (like
> > > e.g. ARM 32 bit).
> > >
> > > The __clock_gettime64 function shall be used instead in the glibc
> > > itself as it supports 64 bit time on those systems.
> > > This patch does not bring any changes to systems with __WORDSIZE ==
> > > 64 as for them the __clock_gettime64 is aliased to __clock_gettime
> > > (in ./include/time.h).
> > >
> > > ---
> > > Changes for v3:
> > > - Fix the commit message (add missing "function" after
> > > __clock_gettime64)
> > > - Refactor __nisfind_server() function to support 64 bit time
> > > with struct timespec instead of struct timeval
> > > - Change expires to __time64_t
> > >
> > > Changes for v2:
> > > - Use only TIMESPEC_TO_TIMEVAL instead of
> > > valid_timespec64_to_timeval in logout.c and logwtmp.c as it is
> > > generic enough to also support struct __timespec64 conversion to
> > > struct timeval ---
> > > benchtests/bench-timing.h | 2 +-
> > > include/random-bits.h | 4 ++--
> > > login/logout.c | 4 ++--
> > > login/logwtmp.c | 5 +++--
> > > nis/nis_call.c | 16
> > > +++++++--------- sysdeps/generic/hp-timing.h |
> > > 4 ++-- sysdeps/generic/memusage.h | 4 ++--
> > > sysdeps/unix/sysv/linux/alpha/osf_gettimeofday.c | 4 ++--
> > > sysdeps/unix/sysv/linux/clock.c | 7 ++-----
> > > 9 files changed, 23 insertions(+), 27 deletions(-)
> > >
> >
> > Does this patch work with "make bench" when
> > sysdeps/generic/hp-timing.h is used, like on arm? I got
> > In file included from ./bench-timing.h:23,
> > from ./bench-skeleton.c:25,
> > from
> > /export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/benchtests/bench-rint.c:45:
> > ./bench-skeleton.c: In function ‘main’:
> > ../sysdeps/generic/hp-timing.h:37:23: error: storage size of ‘tv’
> > isn’t known 37 | struct __timespec64 tv; \
> > | ^~
> > ./bench-timing.h:35:25: note: in expansion of macro ‘HP_TIMING_NOW’
> > 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > | ^~~~~~~~~~~~~
> > ./bench-skeleton.c:82:8: note: in expansion of macro ‘TIMING_NOW’
> > 82 | TIMING_NOW (start);
> > | ^~~~~~~~~~
> > ../sysdeps/generic/hp-timing.h:38:3: error: implicit declaration of
> > function ‘__clock_gettime64’; did you mean ‘clock_gettime’?
> > [-Werror=implicit-function-declaration]
> > 38 | __clock_gettime64 (CLOCK_MONOTONIC, &tv); \
> > | ^~~~~~~~~~~~~~~~~
> > ./bench-timing.h:35:25: note: in expansion of macro ‘HP_TIMING_NOW’
> > 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > | ^~~~~~~~~~~~~
> > ./bench-skeleton.c:82:8: note: in expansion of macro ‘TIMING_NOW’
> > 82 | TIMING_NOW (start);
> > | ^~~~~~~~~~
> > ../sysdeps/generic/hp-timing.h:37:23: error: unused variable ‘tv’
> > [-Werror=unused-variable]
> > 37 | struct __timespec64 tv; \
> > | ^~
> > ./bench-timing.h:35:25: note: in expansion of macro ‘HP_TIMING_NOW’
> > 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > | ^~~~~~~~~~~~~
> > ./bench-skeleton.c:82:8: note: in expansion of macro ‘TIMING_NOW’
> > 82 | TIMING_NOW (start);
> > | ^~~~~~~~~~
> > ../sysdeps/generic/hp-timing.h:37:23: error: storage size of ‘tv’
> > isn’t known 37 | struct __timespec64 tv; \
> > | ^~
> > ./bench-timing.h:35:25: note: in expansion of macro ‘HP_TIMING_NOW’
> > 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > | ^~~~~~~~~~~~~
> > ./bench-skeleton.c:86:8: note: in expansion of macro ‘TIMING_NOW’
> > 86 | TIMING_NOW (end);
> > | ^~~~~~~~~~
> > ../sysdeps/generic/hp-timing.h:37:23: error: unused variable ‘tv’
> > [-Werror=unused-variable]
> > 37 | struct __timespec64 tv; \
> > | ^~
> > ./bench-timing.h:35:25: note: in expansion of macro ‘HP_TIMING_NOW’
> > 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > | ^~~~~~~~~~~~~
> > ./bench-skeleton.c:86:8: note: in expansion of macro ‘TIMING_NOW’
> > 86 | TIMING_NOW (end);
> > | ^~~~~~~~~~
> > ../sysdeps/generic/hp-timing.h:37:23: error: storage size of ‘tv’
> > isn’t known 37 | struct __timespec64 tv; \
> > | ^~
> > ./bench-timing.h:35:25: note: in expansion of macro ‘HP_TIMING_NOW’
> > 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > | ^~~~~~~~~~~~~
> > ./bench-skeleton.c:90:8: note: in expansion of macro ‘TIMING_NOW’
> > 90 | TIMING_NOW (start);
> > | ^~~~~~~~~~
> > ../sysdeps/generic/hp-timing.h:37:23: error: unused variable ‘tv’
> > [-Werror=unused-variable]
> > 37 | struct __timespec64 tv; \
> > | ^~
> > ./bench-timing.h:35:25: note: in expansion of macro ‘HP_TIMING_NOW’
> > 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > | ^~~~~~~~~~~~~
> > ./bench-skeleton.c:90:8: note: in expansion of macro ‘TIMING_NOW’
> > 90 | TIMING_NOW (start);
> > | ^~~~~~~~~~
> > ../sysdeps/generic/hp-timing.h:37:23: error: storage size of ‘tv’
> > isn’t known 37 | struct __timespec64 tv; \
> > | ^~
> > ./bench-timing.h:35:25: note: in expansion of macro ‘HP_TIMING_NOW’
> > 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > | ^~~~~~~~~~~~~
> > ./bench-skeleton.c:94:8: note: in expansion of macro ‘TIMING_NOW’
> > 94 | TIMING_NOW (end);
> > | ^~~~~~~~~~
> > ../sysdeps/generic/hp-timing.h:37:23: error: unused variable ‘tv’
> > [-Werror=unused-variable]
> > 37 | struct __timespec64 tv; \
> > | ^~
> > ./bench-timing.h:35:25: note: in expansion of macro ‘HP_TIMING_NOW’
> > 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > | ^~~~~~~~~~~~~
> > ./bench-skeleton.c:94:8: note: in expansion of macro ‘TIMING_NOW’
> > 94 | TIMING_NOW (end);
> > | ^~~~~~~~~~
> > ../sysdeps/generic/hp-timing.h:37:23: error: storage size of ‘tv’
> > isn’t known 37 | struct __timespec64 tv; \
> > | ^~
> > ./bench-timing.h:35:25: note: in expansion of macro ‘HP_TIMING_NOW’
> > 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > | ^~~~~~~~~~~~~
> > ./bench-skeleton.c:103:3: note: in expansion of macro ‘TIMING_NOW’
> > 103 | TIMING_NOW (start);
> > | ^~~~~~~~~~
> > ../sysdeps/generic/hp-timing.h:37:23: error: unused variable ‘tv’
> > [-Werror=unused-variable]
> > 37 | struct __timespec64 tv; \
> > | ^~
> > ./bench-timing.h:35:25: note: in expansion of macro ‘HP_TIMING_NOW’
> > 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > | ^~~~~~~~~~~~~
> > ./bench-skeleton.c:103:3: note: in expansion of macro ‘TIMING_NOW’
> > 103 | TIMING_NOW (start);
> > | ^~~~~~~~~~
> > ../sysdeps/generic/hp-timing.h:37:23: error: storage size of ‘tv’
> > isn’t known 37 | struct __timespec64 tv; \
> > | ^~
> > ./bench-timing.h:35:25: note: in expansion of macro ‘HP_TIMING_NOW’
> > 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > | ^~~~~~~~~~~~~
> > ./bench-skeleton.c:106:3: note: in expansion of macro ‘TIMING_NOW’
> > 106 | TIMING_NOW (end);
> > | ^~~~~~~~~~
> > ../sysdeps/generic/hp-timing.h:37:23: error: unused variable ‘tv’
> > [-Werror=unused-variable]
> > 37 | struct __timespec64 tv; \
> > | ^~
> > ./bench-timing.h:35:25: note: in expansion of macro ‘HP_TIMING_NOW’
> > 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > | ^~~~~~~~~~~~~
> > ./bench-skeleton.c:106:3: note: in expansion of macro ‘TIMING_NOW’
> > 106 | TIMING_NOW (end);
> > | ^~~~~~~~~~
> > cc1: all warnings being treated as errors
>
> How shall I reproduce this error?
Apply the enclosed patch and do
$ make USE_CLOCK_GETTIME=1 bench
> Was it supposed to be catch with build-many-glibc.py ?
>
No, "make bench" isn't tested by build-many-glibc.py.
--
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-benchtests-Restore-the-clock_gettime-option.patch
Type: text/x-patch
Size: 2649 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20200521/6bac17c4/attachment-0001.bin>
More information about the Libc-alpha
mailing list