From 600f00b747ff42eb0aa778536d3ef602e8bcd550 Mon Sep 17 00:00:00 2001 From: Alistair Francis Date: Mon, 23 Dec 2019 13:26:50 -0800 Subject: linux: Use long time_t for wait4/getrusage The Linux kernel expects rusage to use a 32-bit time_t, even on archs with a 64-bit time_t (like RV32). To address this let's convert rusage 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. Reviewed-by: Lukasz Majewski Reviewed-by: Adhemerval Zanella --- include/sys/resource.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include') diff --git a/include/sys/resource.h b/include/sys/resource.h index 9d604dfe3e..64925f257c 100644 --- a/include/sys/resource.h +++ b/include/sys/resource.h @@ -134,5 +134,16 @@ extern int __getrusage (enum __rusage_who __who, struct rusage *__usage) extern int __setrlimit (enum __rlimit_resource __resource, const struct rlimit *__rlimits); libc_hidden_proto (__setrlimit); + +#if __TIMESIZE == 64 +# define __getrusage64 __getrusage +# define __wait4_time64 __wait4 +#else +extern int __getrusage64 (enum __rusage_who who, struct __rusage64 *usage); +libc_hidden_proto (__getrusage64) +extern pid_t __wait4_time64 (pid_t pid, int *stat_loc, int options, + struct __rusage64 *usage); +libc_hidden_proto (__wait4_time64) +#endif #endif #endif -- cgit v1.2.3-70-g09d2