diff options
author | Alistair Francis <alistair.francis@wdc.com> | 2019-12-23 11:45:01 -0800 |
---|---|---|
committer | Alistair Francis <alistair.francis@wdc.com> | 2020-04-02 09:21:06 -0700 |
commit | a51e03588937ad804a9f583ea3d0fc0a4d088c33 (patch) | |
tree | f77bf16cbc4562ca3cc40625042406f20f230e78 /include | |
parent | 1c634e677f584ea264f984eb408a5142150af855 (diff) | |
download | glibc-a51e03588937ad804a9f583ea3d0fc0a4d088c33.tar glibc-a51e03588937ad804a9f583ea3d0fc0a4d088c33.tar.gz glibc-a51e03588937ad804a9f583ea3d0fc0a4d088c33.tar.bz2 glibc-a51e03588937ad804a9f583ea3d0fc0a4d088c33.zip |
linux: Use long time_t __getitimer/__setitimer
The Linux kernel expects itimerval to use a 32-bit time_t, even on archs
with a 64-bit time_t (like RV32). To address this let's convert
itimerval to/from 32-bit and 64-bit to ensure the kernel always gets
a 32-bit time_t.
While we are converting these functions let's also convert them to be
the y2038 safe versions. This means there is a *64 function that is
called by a backwards compatible wrapper.
Tested-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/time.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/time.h b/include/time.h index 2523e0ff0d..4522fe9c4f 100644 --- a/include/time.h +++ b/include/time.h @@ -6,6 +6,7 @@ # include <bits/types/locale_t.h> # include <stdbool.h> # include <time/mktime-internal.h> +# include <sys/time.h> # include <endian.h> # include <time-clockid.h> # include <sys/time.h> @@ -128,6 +129,20 @@ struct __itimerval64 #endif #if __TIMESIZE == 64 +# define __getitimer64 __getitimer +# define __setitimer64 __setitimer +#else +extern int __getitimer64 (enum __itimer_which __which, + struct __itimerval64 *__value); + +libc_hidden_proto (__getitimer64) +extern int __setitimer64 (enum __itimer_which __which, + const struct __itimerval64 *__restrict __new, + struct __itimerval64 *__restrict __old); +libc_hidden_proto (__setitimer64) +#endif + +#if __TIMESIZE == 64 # define __ctime64 ctime #else extern char *__ctime64 (const __time64_t *__timer) __THROW; |