From 248ddc80b145515286bfb75d08034ad4c0fdb08e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Fri, 11 Apr 2025 11:00:40 +0200 Subject: [PATCH] tools/nolibc: use pselect6_time64 if available MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit riscv32 does not have any of the older select systemcalls. Use pselect6_time64 instead. poll() is also used to implement sleep(). Signed-off-by: Thomas Weißschuh Acked-by: Willy Tarreau --- tools/include/nolibc/sys.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index d07456d6e5727..2f33efc3c5ee5 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -902,6 +902,14 @@ int sys_select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeva t.tv_nsec = timeout->tv_usec * 1000; } return my_syscall6(__NR_pselect6, nfds, rfds, wfds, efds, timeout ? &t : NULL, NULL); +#elif defined(__NR_pselect6_time64) + struct __kernel_timespec t; + + if (timeout) { + t.tv_sec = timeout->tv_sec; + t.tv_nsec = timeout->tv_usec * 1000; + } + return my_syscall6(__NR_pselect6_time64, nfds, rfds, wfds, efds, timeout ? &t : NULL, NULL); #else return __nolibc_enosys(__func__, nfds, rfds, wfds, efds, timeout); #endif -- 2.51.0