Rollup merge of #155284 - RalfJung:net-nonblocking, r=Mark-Simulacrum

net::tcp/udp: fix docs about how set_nonblocking is implemented

`fcntl` `FIONBIO` doesn't even make sense, it should be `fcntl` `F_SETFL`. However, for some reason we are using `ioctl` by default -- except on Solaris where this doesn't seem to work very well.

Honestly what I would have expected is that we just always use `FileDesc::set_nonblocking` also for network sockets, but for some reason we don't and there are no comments explaining this choice. Cc @nikarh (for "vita") @joboet
This commit is contained in:
Jonathan Brouwer
2026-04-18 19:23:12 +02:00
committed by GitHub
2 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -582,8 +582,8 @@ pub fn take_error(&self) -> io::Result<Option<io::Error>> {
/// to be retried, an error with kind [`io::ErrorKind::WouldBlock`] is
/// returned.
///
/// On Unix platforms, calling this method corresponds to calling `fcntl`
/// `FIONBIO`. On Windows calling this method corresponds to calling
/// On most Unix platforms, calling this method corresponds to calling `ioctl`
/// `FIONBIO`. On Windows, calling this method corresponds to calling
/// `ioctlsocket` `FIONBIO`.
///
/// # Examples
@@ -988,8 +988,8 @@ pub fn take_error(&self) -> io::Result<Option<io::Error>> {
/// IO operation could not be completed and needs to be retried, an error
/// with kind [`io::ErrorKind::WouldBlock`] is returned.
///
/// On Unix platforms, calling this method corresponds to calling `fcntl`
/// `FIONBIO`. On Windows calling this method corresponds to calling
/// On most Unix platforms, calling this method corresponds to calling `ioctl`
/// `FIONBIO`. On Windows, calling this method corresponds to calling
/// `ioctlsocket` `FIONBIO`.
///
/// # Examples
+2 -2
View File
@@ -786,8 +786,8 @@ pub fn peek(&self, buf: &mut [u8]) -> io::Result<usize> {
/// and needs to be retried, an error with kind
/// [`io::ErrorKind::WouldBlock`] is returned.
///
/// On Unix platforms, calling this method corresponds to calling `fcntl`
/// `FIONBIO`. On Windows calling this method corresponds to calling
/// On most Unix platforms, calling this method corresponds to calling `ioctl`
/// `FIONBIO`. On Windows, calling this method corresponds to calling
/// `ioctlsocket` `FIONBIO`.
///
/// # Examples