[libc-commits] [libc] 72aa388 - [libc][poll] remove entrypoint for riscv (#125941)

via libc-commits libc-commits at lists.llvm.org
Wed Feb 5 13:56:35 PST 2025


Author: Nick Desaulniers
Date: 2025-02-05T13:56:30-08:00
New Revision: 72aa3889fb725ce27817f06c9d7754e78cff9fc2

URL: https://github.com/llvm/llvm-project/commit/72aa3889fb725ce27817f06c9d7754e78cff9fc2
DIFF: https://github.com/llvm/llvm-project/commit/72aa3889fb725ce27817f06c9d7754e78cff9fc2.diff

LOG: [libc][poll] remove entrypoint for riscv (#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).

Link: #125940
Fixes: #125118

Added: 
    

Modified: 
    libc/config/linux/riscv/entrypoints.txt
    libc/src/poll/linux/poll.cpp

Removed: 
    


################################################################################
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