From: Thomas Weißschuh Date: Fri, 11 Apr 2025 09:00:40 +0000 (+0200) Subject: tools/nolibc: use pselect6_time64 if available X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=248ddc80b145515286bfb75d08034ad4c0fdb08e;p=users%2Fdwmw2%2Flinux.git tools/nolibc: use pselect6_time64 if available 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 --- 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