From 81a6eee3570dc475672404670816a5c901e2357b Mon Sep 17 00:00:00 2001 From: Akhil T Thomas Date: Wed, 27 Mar 2024 00:32:12 +0100 Subject: [PATCH] add O_NONBLOCK for udp/tcp Signed-off-by: Akhil T Thomas --- src/sys/unix/tcp.rs | 1 + src/sys/unix/uds/listener.rs | 1 + tests/unix_pipe.rs | 6 +++--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sys/unix/tcp.rs b/src/sys/unix/tcp.rs index d16b51ab1..a8d8d0b46 100644 --- a/src/sys/unix/tcp.rs +++ b/src/sys/unix/tcp.rs @@ -115,6 +115,7 @@ pub(crate) fn accept(listener: &net::TcpListener) -> io::Result<(net::TcpStream, target_os = "espidf", target_os = "vita", target_os = "hermit", + target_os = "nto", ))] syscall!(fcntl(s.as_raw_fd(), libc::F_SETFL, libc::O_NONBLOCK))?; diff --git a/src/sys/unix/uds/listener.rs b/src/sys/unix/uds/listener.rs index 1ed1dfdaf..b94243720 100644 --- a/src/sys/unix/uds/listener.rs +++ b/src/sys/unix/uds/listener.rs @@ -99,6 +99,7 @@ pub(crate) fn accept(listener: &net::UnixListener) -> io::Result<(UnixStream, So all(target_arch = "x86", target_os = "android"), target_os = "espidf", target_os = "vita", + target_os = "nto", ))] syscall!(fcntl(socket, libc::F_SETFL, libc::O_NONBLOCK))?; diff --git a/tests/unix_pipe.rs b/tests/unix_pipe.rs index 45ae828cb..be55cfba6 100644 --- a/tests/unix_pipe.rs +++ b/tests/unix_pipe.rs @@ -53,7 +53,7 @@ fn smoke() { } #[test] -#[cfg_attr(target_os = "nto", ignore = "Read close events are detected by NTO")] +#[cfg_attr(target_os = "nto", ignore = "Writer fd close events do not trigger POLLHUP on nto target")] fn event_when_sender_is_dropped() { let mut poll = Poll::new().unwrap(); let mut events = Events::with_capacity(8); @@ -92,7 +92,7 @@ fn event_when_sender_is_dropped() { } #[test] -#[cfg_attr(target_os = "nto", ignore = "Read close events are detected by NTO")] +#[cfg_attr(target_os = "nto", ignore = "Read fd close events do not trigger POLLHUP on nto target")] fn event_when_receiver_is_dropped() { let mut poll = Poll::new().unwrap(); let mut events = Events::with_capacity(8); @@ -126,7 +126,7 @@ fn event_when_receiver_is_dropped() { } #[test] -#[cfg_attr(target_os = "nto", ignore = "Read close events are detected by NTO")] +#[cfg_attr(target_os = "nto", ignore = "Read/Write close eventsdo not trigger POLLHUP on nto target")] fn from_child_process_io() { // `cat` simply echo everything that we write via standard in. let mut child = Command::new("cat")