Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc][poll] remove entrypoint for riscv #125941

Merged
merged 1 commit into from
Feb 5, 2025

Conversation

nickdesaulniers
Copy link
Member

@nickdesaulniers nickdesaulniers commented Feb 5, 2025

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

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: llvm#125118
@llvmbot
Copy link
Member

llvmbot commented Feb 5, 2025

@llvm/pr-subscribers-libc

Author: Nick Desaulniers (nickdesaulniers)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/125941.diff

2 Files Affected:

  • (modified) libc/config/linux/riscv/entrypoints.txt (+2-1)
  • (modified) libc/src/poll/linux/poll.cpp (+4-2)
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
 

@nickdesaulniers
Copy link
Member Author

it seems I can barely keep the riscv32 bot clean today. oops!

@nickdesaulniers nickdesaulniers merged commit 72aa388 into llvm:main Feb 5, 2025
13 of 15 checks passed
@nickdesaulniers nickdesaulniers deleted the poll_fixup branch February 5, 2025 21:56
Icohedron pushed a commit to Icohedron/llvm-project that referenced this pull request Feb 11, 2025
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: llvm#125940
Fixes: llvm#125118
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants