summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNadav Tasher <tashernadav@gmail.com>2025-01-07 00:51:16 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2025-01-07 10:09:53 +0100
commit5896cb551cd402c50c7af3037d71b356559fc7b0 (patch)
tree33d0e452f56288e45285ab0d8708c87f14189d52
parent9ef8c7757dfda32023451b7ea90f5d49e836b21f (diff)
time64_helpers.h: error out when attempting to compile with TIME64 for 32bit targets on Linux versions prior to 5.1.0
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. This change was previously introduced in `features.h`, but was reverted due to inclusion errors when compiling other projects. Signed-off-by: Nadav Tasher <tashernadav@gmail.com>
-rw-r--r--include/internal/time64_helpers.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/internal/time64_helpers.h b/include/internal/time64_helpers.h
index 2284aacd9..e2ed0f3bb 100644
--- a/include/internal/time64_helpers.h
+++ b/include/internal/time64_helpers.h
@@ -1,10 +1,15 @@
#ifndef _TIME64_HELPERS_H
#define _TIME64_HELPERS_H
+#include <linux/version.h>
#include <bits/types.h>
#include <time.h>
#include <stddef.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
+
struct __ts64_struct {
__S64_TYPE tv_sec;
__S64_TYPE tv_nsec;