summaryrefslogtreecommitdiff
path: root/tools/include/nolibc/sys/timerfd.h
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2025-12-20 14:55:49 +0100
committerThomas Weißschuh <linux@weissschuh.net>2026-01-04 10:29:00 +0100
commitba7fd0384530e3dd20ea873aac21c473e3e461ae (patch)
treec6d1a866b7bbb66a73f666368cdf13f3f79a5bc3 /tools/include/nolibc/sys/timerfd.h
parentb8f4f5d1b99e2ae73fd448e9bbd16dc244e6586c (diff)
tools/nolibc: prefer explicit 64-bit time-related system calls
Make sure to always use the 64-bit safe system calls in preparation for 64-bit time_t on 32-bit architectures. Also prevent issues on kernels which disable CONFIG_COMPAT_32BIT_TIME and therefore don't provide the 32-bit system calls anymore. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Link: https://patch.msgid.link/20251220-nolibc-uapi-types-v3-5-c662992f75d7@weissschuh.net
Diffstat (limited to 'tools/include/nolibc/sys/timerfd.h')
-rw-r--r--tools/include/nolibc/sys/timerfd.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/include/nolibc/sys/timerfd.h b/tools/include/nolibc/sys/timerfd.h
index 5dd61030c991..66f779553d31 100644
--- a/tools/include/nolibc/sys/timerfd.h
+++ b/tools/include/nolibc/sys/timerfd.h
@@ -32,9 +32,7 @@ int timerfd_create(int clockid, int flags)
static __attribute__((unused))
int sys_timerfd_gettime(int fd, struct itimerspec *curr_value)
{
-#if defined(__NR_timerfd_gettime)
- return my_syscall2(__NR_timerfd_gettime, fd, curr_value);
-#else
+#if defined(__NR_timerfd_gettime64)
struct __kernel_itimerspec kcurr_value;
int ret;
@@ -42,6 +40,8 @@ int sys_timerfd_gettime(int fd, struct itimerspec *curr_value)
__nolibc_timespec_kernel_to_user(&kcurr_value.it_interval, &curr_value->it_interval);
__nolibc_timespec_kernel_to_user(&kcurr_value.it_value, &curr_value->it_value);
return ret;
+#else
+ return my_syscall2(__NR_timerfd_gettime, fd, curr_value);
#endif
}
@@ -56,9 +56,7 @@ static __attribute__((unused))
int sys_timerfd_settime(int fd, int flags,
const struct itimerspec *new_value, struct itimerspec *old_value)
{
-#if defined(__NR_timerfd_settime)
- return my_syscall4(__NR_timerfd_settime, fd, flags, new_value, old_value);
-#else
+#if defined(__NR_timerfd_settime64)
struct __kernel_itimerspec knew_value, kold_value;
int ret;
@@ -70,6 +68,8 @@ int sys_timerfd_settime(int fd, int flags,
__nolibc_timespec_kernel_to_user(&kold_value.it_value, &old_value->it_value);
}
return ret;
+#else
+ return my_syscall4(__NR_timerfd_settime, fd, flags, new_value, old_value);
#endif
}