Using 64bit time on 32bit targets was only introduced in Linux 5.1.0.
On versions prior to that, compiling uClibc-ng produces incorrect headers
that cause the `clock_nanosleep` syscall to receive incorrect arguments.
Signed-off-by: Nadav Tasher <tashernadav(a)gmail.com>
---
include/features.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/features.h b/include/features.h
index 1a4efb9db..0b09d71a2 100644
--- a/include/features.h
+++ b/include/features.h
@@ -449,6 +449,12 @@
# include <libc-internal.h>
#endif
+#include <linux/version.h>
+
+#if defined(__UCLIBC_USE_TIME64__) && __TARGET_ARCH_BITS__ == 32 && LINUX_VERSION_CODE < KERNEL_VERSION(5,1,0)
+#error 64bit time on 32bit targets is not supported on Linux < 5.1.0
+#endif
+
#if defined(__UCLIBC_USE_TIME64__) || __TARGET_ARCH_BITS__ == 64
#define __USE_TIME_BITS64 1
#endif
--
2.34.1
Without this change `timespec` is too large for the `clock_nanosleep` syscall,
which translates to sleep(0) on 32bit systems when TIME64 is enabled (the default).
Tested on MIPS.
Signed-off-by: Nadav Tasher <tashernadav(a)gmail.com>
---
include/time.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/time.h b/include/time.h
index 1a1408990..25dfb9e2e 100644
--- a/include/time.h
+++ b/include/time.h
@@ -118,7 +118,7 @@ typedef __timer_t timer_t;
has nanoseconds instead of microseconds. */
struct timespec
{
- __time_t tv_sec; /* Seconds. */
+ int tv_sec; /* Seconds. */
long int tv_nsec; /* Nanoseconds. */
};
--
2.34.1