diff options
author | Lukasz Majewski <lukma@denx.de> | 2019-11-05 17:04:24 +0100 |
---|---|---|
committer | Lukasz Majewski <lukma@denx.de> | 2019-12-05 23:16:54 +0100 |
commit | 562cdc19c761b6749ae31845156366d4b319e200 (patch) | |
tree | 412dba72f1cbb7ae53053cca7c144996ad3dae01 /include | |
parent | ab65136e7233183a1f35c7d36867b5937844b368 (diff) | |
download | glibc-562cdc19c761b6749ae31845156366d4b319e200.tar glibc-562cdc19c761b6749ae31845156366d4b319e200.tar.gz glibc-562cdc19c761b6749ae31845156366d4b319e200.tar.bz2 glibc-562cdc19c761b6749ae31845156366d4b319e200.zip |
y2038: linux: Provide __timer_gettime64 implementation
This patch provides new __timer_gettime64 explicit 64 bit function for reading
status of specified timer. To be more precise - the remaining time and interval
set with timer_settime.
Moreover, a 32 bit version - __timer_gettime has been refactored to internally
use __timer_gettime64.
The __timer_gettime is now supposed to be used on systems still supporting 32
bit time (__TIMESIZE != 64) - hence the necessary conversion from 64 bit struct
__timespec64 to struct timespec.
The new __timer_gettime64 syscall available from Linux 5.1+ has been used, when
applicable.
The original INLINE_SYSCALL() macro has been replaced with
INLINE_SYSCALL_CALL() to avoid explicit passing the number of arguments.
Build tests:
- The code has been tested on x86_64/x86 (native compilation):
make PARALLELMFLAGS="-j8" && make check PARALLELMFLAGS="-j8" && \\
make xcheck PARALLELMFLAGS="-j8"
- The glibc has been build tested (make PARALLELMFLAGS="-j8") for
x86 (i386), x86_64-x32, and armv7
Run-time tests:
- Run specific tests on ARM/x86 32bit systems (qemu):
https://github.com/lmajewski/meta-y2038 and run tests:
https://github.com/lmajewski/y2038-tests/commits/master
- Use of cross-test-ssh.sh for ARM (armv7):
make PARALLELMFLAGS="-j8" test-wrapper='./cross-test-ssh.sh root@192.168.7.2' xcheck
Linux kernel, headers and minimal kernel version for glibc build test
matrix:
- Linux v5.1 (with timer_gettime64) and glibc build with v5.1 as
minimal kernel version (--enable-kernel="5.1.0")
The __ASSUME_TIME64_SYSCALLS flag defined.
- Linux v5.1 and default minimal kernel version
The __ASSUME_TIME64_SYSCALLS not defined, but kernel supports timer_gettime64
syscall.
- Linux v4.19 (no timer_gettime64 support) with default minimal kernel version
for contemporary glibc (3.2.0)
This kernel doesn't support timer_gettime64 syscall, so the fallback to
timer_gettime is tested.
Above tests were performed with Y2038 redirection applied as well as without
(so the __TIMESIZE != 64 execution path is checked as well).
No regressions were observed.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/time.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/time.h b/include/time.h index 1eb3d82740..51c0fce580 100644 --- a/include/time.h +++ b/include/time.h @@ -179,6 +179,13 @@ extern int __futimens64 (int fd, const struct __timespec64 tsp[2]); libc_hidden_proto (__futimens64); #endif +#if __TIMESIZE == 64 +# define __timer_gettime64 __timer_gettime +#else +extern int __timer_gettime64 (timer_t timerid, struct __itimerspec64 *value); +libc_hidden_proto (__timer_gettime64); +#endif + /* Compute the `struct tm' representation of T, offset OFFSET seconds east of UTC, and store year, yday, mon, mday, wday, hour, min, sec into *TP. |