1#[cfg(unix)]
2use std::os::fd::AsFd;
34#[cfg(unix)]
5#[allow(unused_variables)]
6#[track_caller]
7pub(crate) fn check_socket_for_blocking<S: AsFd>(s: &S) -> crate::io::Result<()> {
8#[cfg(not(tokio_allow_from_blocking_fd))]
9{
10let sock = socket2::SockRef::from(s);
1112debug_assert!(
13 sock.nonblocking()?,
14"Registering a blocking socket with the tokio runtime is unsupported. \
15 If you wish to do anyways, please add `--cfg tokio_allow_from_blocking_fd` to your \
16 RUSTFLAGS. See github.com/tokio-rs/tokio/issues/7172 for details."
17);
18 }
1920Ok(())
21}
2223#[cfg(not(unix))]
24#[allow(unused_variables)]
25pub(crate) fn check_socket_for_blocking<S>(s: &S) -> crate::io::Result<()> {
26// we cannot retrieve the nonblocking status on windows
27 // and i dont know how to support wasi yet
28Ok(())
29}