[libc] Enable poll function for riscv (#139180)

RV32 uses SYS_ppoll_time64 instead of SYS_ppoll, but the call is the
same.
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index c2a31b9..4bc27b8 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -33,8 +33,7 @@
     libc.src.fcntl.openat
 
     # poll.h entrypoints
-    # TODO: https://github.com/llvm/llvm-project/issues/125940
-    # libc.src.poll.poll
+    libc.src.poll.poll
 
     # sched.h entrypoints
     libc.src.sched.sched_get_priority_max
diff --git a/libc/include/sys/syscall.h.def b/libc/include/sys/syscall.h.def
index 03c19eb..ca5a6cc 100644
--- a/libc/include/sys/syscall.h.def
+++ b/libc/include/sys/syscall.h.def
@@ -1517,6 +1517,10 @@
 #define SYS_ppoll __NR_ppoll
 #endif
 
+#ifdef __NR_ppoll_time64
+#define SYS_ppoll_time64 __NR_ppoll_time64
+#endif
+
 #ifdef __NR_prctl
 #define SYS_prctl __NR_prctl
 #endif
diff --git a/libc/src/poll/linux/poll.cpp b/libc/src/poll/linux/poll.cpp
index d7c1958..2579ec0 100644
--- a/libc/src/poll/linux/poll.cpp
+++ b/libc/src/poll/linux/poll.cpp
@@ -18,14 +18,24 @@
 
 #include <sys/syscall.h> // SYS_poll, SYS_ppoll
 
+#ifdef SYS_poll
+constexpr auto POLL_SYSCALL_ID = SYS_poll;
+#elif defined(SYS_ppoll)
+constexpr auto POLL_SYSCALL_ID = SYS_ppoll;
+#elif defined(SYS_ppoll_time64)
+constexpr auto POLL_SYSCALL_ID = SYS_ppoll_time64;
+#else
+#error "poll, ppoll, ppoll_time64 syscalls not available."
+#endif
+
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(int, poll, (pollfd * fds, nfds_t nfds, int timeout)) {
   int ret = 0;
 
 #ifdef SYS_poll
-  ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_poll, fds, nfds, timeout);
-#elif defined(SYS_ppoll)
+  ret = LIBC_NAMESPACE::syscall_impl<int>(POLL_SYSCALL_ID, fds, nfds, timeout);
+#elif defined(SYS_ppoll) || defined(SYS_ppoll_time64)
   timespec ts, *tsp;
   if (timeout >= 0) {
     ts.tv_sec = timeout / 1000;
@@ -34,11 +44,8 @@
   } else {
     tsp = nullptr;
   }
-  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?"
+  ret = LIBC_NAMESPACE::syscall_impl<int>(POLL_SYSCALL_ID, fds, nfds, tsp,
+                                          nullptr, 0);
 #endif
 
   if (ret < 0) {