[libc-commits] [libc] [libc][poll] remove entrypoint for riscv (PR #125941)
Nick Desaulniers via libc-commits
libc-commits at lists.llvm.org
Wed Feb 5 13:53:04 PST 2025
https://github.com/nickdesaulniers created https://github.com/llvm/llvm-project/pull/125941
riscv32 specifically doesn't provide EITHER SYS_poll or SYS_ppoll. We may be
able to reimplement poll in terms of syscalls to SYS_ppoll_time64, but will
leave that as a TODO for the future. (Such as when we want to be able to cross
compile for riscv32).
Fixes: #125118
>From 9bbd8cc442f6097e791d6335f7232d9615b4121f Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Wed, 5 Feb 2025 13:50:59 -0800
Subject: [PATCH] [libc][poll] remove entrypoint for riscv
riscv32 specifically doesn't provide EITHER SYS_poll or SYS_ppoll. We may be
able to reimplement poll in terms of syscalls to SYS_ppoll_time64, but will
leave that as a TODO for the future. (Such as when we want to be able to cross
compile for riscv32).
Fixes: #125118
---
libc/config/linux/riscv/entrypoints.txt | 3 ++-
libc/src/poll/linux/poll.cpp | 6 ++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index c405172c8a13b7..6e67ea559d57b0 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -33,7 +33,8 @@ set(TARGET_LIBC_ENTRYPOINTS
libc.src.fcntl.openat
# poll.h entrypoints
- libc.src.poll.poll
+ # TODO: https://github.com/llvm/llvm-project/issues/125940
+ # libc.src.poll.poll
# sched.h entrypoints
libc.src.sched.sched_get_priority_max
diff --git a/libc/src/poll/linux/poll.cpp b/libc/src/poll/linux/poll.cpp
index 886e57ccd5942b..d7c195878ae127 100644
--- a/libc/src/poll/linux/poll.cpp
+++ b/libc/src/poll/linux/poll.cpp
@@ -21,9 +21,10 @@
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(int, poll, (pollfd * fds, nfds_t nfds, int timeout)) {
+ int ret = 0;
#ifdef SYS_poll
- int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_poll, fds, nfds, timeout);
+ ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_poll, fds, nfds, timeout);
#elif defined(SYS_ppoll)
timespec ts, *tsp;
if (timeout >= 0) {
@@ -33,9 +34,10 @@ LLVM_LIBC_FUNCTION(int, poll, (pollfd * fds, nfds_t nfds, int timeout)) {
} else {
tsp = nullptr;
}
- int ret =
+ ret =
LIBC_NAMESPACE::syscall_impl<int>(SYS_ppoll, fds, nfds, tsp, nullptr, 0);
#else
+// TODO: https://github.com/llvm/llvm-project/issues/125940
#error "SYS_ppoll_time64?"
#endif
More information about the libc-commits
mailing list