From a51e03588937ad804a9f583ea3d0fc0a4d088c33 Mon Sep 17 00:00:00 2001 From: Alistair Francis Date: Mon, 23 Dec 2019 11:45:01 -0800 Subject: [PATCH] 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 Reviewed-by: Adhemerval Zanella --- include/time.h | 15 +++++ sysdeps/unix/syscalls.list | 2 - sysdeps/unix/sysv/linux/getitimer.c | 61 ++++++++++++++++++ sysdeps/unix/sysv/linux/setitimer.c | 90 +++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/tv32-compat.h | 31 +++++++++ 5 files changed, 197 insertions(+), 2 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/getitimer.c create mode 100644 sysdeps/unix/sysv/linux/setitimer.c create mode 100644 sysdeps/unix/sysv/linux/tv32-compat.h 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 # include # include