about summary refs log tree commit diff
path: root/include/sys
diff options
context:
space:
mode:
authorAlistair Francis <alistair.francis@wdc.com>2019-12-23 13:26:50 -0800
committerAlistair Francis <alistair.francis@wdc.com>2020-04-02 09:21:06 -0700
commit600f00b747ff42eb0aa778536d3ef602e8bcd550 (patch)
treef488e09a78fcd560f95bb885d0cf5148d3294f87 /include/sys
parent5d24ba82c49b75c9f4264b5d62c4e88f4082a99e (diff)
downloadglibc-600f00b747ff42eb0aa778536d3ef602e8bcd550.tar.gz
glibc-600f00b747ff42eb0aa778536d3ef602e8bcd550.tar.xz
glibc-600f00b747ff42eb0aa778536d3ef602e8bcd550.zip
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 <lukma@denx.de>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'include/sys')
-rw-r--r--include/sys/resource.h11
1 files changed, 11 insertions, 0 deletions
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