blob: 8976b3748b81297f9b090fb809643f2f78d6e0d4 [file] [log] [blame]
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001From 7284c7ae0df9aa5a9c8aa0a81a018e17289fe2c4 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 8 Sep 2022 07:22:26 -0700
4Subject: [PATCH] portability: Fix timer_settime_wrap for 32bit systems with
5 64bit time_t
6
7glibc does not define SYS_timer_settime if the 32bit syscall is not
8available, new architectures like riscv32 has defaulted to 64bit time_t
9from get go and avoided wiring 32bit syscall, therefore alias it to
1064bit version here
11
12Upstream-Status: Submitted [https://github.com/landley/toybox/pull/373]
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 lib/portability.c | 6 ++++++
16 1 file changed, 6 insertions(+)
17
18diff --git a/lib/portability.c b/lib/portability.c
19index d955d081..4baa9367 100644
20--- a/lib/portability.c
21+++ b/lib/portability.c
22@@ -711,6 +711,12 @@ int timer_create_wrap(clockid_t c, struct sigevent *se, timer_t *t)
23 return 0;
24 }
25
26+#if !defined(SYS_timer_settime) && defined(SYS_timer_settime64)
27+// glibc does not define defines SYS_timer_settime on 32-bit systems
28+// with 64-bit time_t defaults e.g. riscv32
29+#define SYS_timer_settime SYS_timer_settime64
30+#endif
31+
32 int timer_settime_wrap(timer_t t, int flags, struct itimerspec *val,
33 struct itimerspec *old)
34 {
35--
362.37.3
37