From b68ea4156a7d0d63ba3351fb0299ea958f16e7fe Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Thu, 29 Jan 2026 15:12:10 +0100 Subject: [PATCH] io: hardcode platform list for `poll_write` (#7872) --- tokio/src/io/poll_evented.rs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tokio/src/io/poll_evented.rs b/tokio/src/io/poll_evented.rs index 9f535db01..77f46deab 100644 --- a/tokio/src/io/poll_evented.rs +++ b/tokio/src/io/poll_evented.rs @@ -188,6 +188,7 @@ feature! { // Read more: // https://github.com/tokio-rs/tokio/issues/5866 #[cfg(all( + // keep in sync with poll_write not(mio_unsupported_force_poll_poll), any( // epoll @@ -240,7 +241,28 @@ feature! { // that the socket buffer is full. Unfortunately this assumption // fails for level-triggered selectors (like on Windows or poll even for // UNIX): https://github.com/tokio-rs/tokio/issues/5866 - if n > 0 && (!cfg!(windows) && !cfg!(mio_unsupported_force_poll_poll) && n < buf.len()) { + #[cfg(all( + // keep in sync with poll_read + not(mio_unsupported_force_poll_poll), + any( + // epoll + target_os = "android", + target_os = "illumos", + target_os = "linux", + target_os = "redox", + // kqueue + target_os = "dragonfly", + target_os = "freebsd", + target_os = "ios", + target_os = "macos", + target_os = "netbsd", + target_os = "openbsd", + target_os = "tvos", + target_os = "visionos", + target_os = "watchos", + ) + ))] + if 0 < n && n < buf.len() { self.registration.clear_readiness(evt); }