From 2d5761b87b24438b9a89fb8d82995f31a0126f68 Mon Sep 17 00:00:00 2001 From: Maerten Farya Date: Fri, 4 Sep 2026 13:31:17 +0200 Subject: [PATCH] fix: add support for QNX7 w/ io-sock --- src/lib.rs | 8 ++++---- src/sockaddr.rs | 6 +++--- src/socket.rs | 27 ++++++++++++++++++--------- src/sys/unix.rs | 21 +++++++++++++-------- 4 files changed, 38 insertions(+), 24 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 3d1a75dd..77e91ef0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -457,7 +457,7 @@ pub struct TcpKeepalive { target_os = "openbsd", target_os = "redox", target_os = "solaris", - target_os = "nto", + all(target_os = "nto", not(target_env = "nto71_iosock")), target_os = "espidf", target_os = "vita", target_os = "haiku", @@ -468,7 +468,7 @@ pub struct TcpKeepalive { target_os = "openbsd", target_os = "redox", target_os = "solaris", - target_os = "nto", + all(target_os = "nto", not(target_env = "nto71_iosock")), target_os = "espidf", target_os = "vita", target_os = "haiku", @@ -487,7 +487,7 @@ impl TcpKeepalive { target_os = "openbsd", target_os = "redox", target_os = "solaris", - target_os = "nto", + all(target_os = "nto", not(target_env = "nto71_iosock")), target_os = "espidf", target_os = "vita", target_os = "haiku", @@ -498,7 +498,7 @@ impl TcpKeepalive { target_os = "openbsd", target_os = "redox", target_os = "solaris", - target_os = "nto", + all(target_os = "nto", not(target_env = "nto71_iosock")), target_os = "espidf", target_os = "vita", target_os = "haiku", diff --git a/src/sockaddr.rs b/src/sockaddr.rs index 0b0189a3..0ff73513 100644 --- a/src/sockaddr.rs +++ b/src/sockaddr.rs @@ -393,7 +393,7 @@ impl From for SockAddr { target_os = "visionos", target_os = "macos", target_os = "netbsd", - target_os = "nto", + all(target_os = "nto", not(target_env = "nto71_iosock")), target_os = "openbsd", target_os = "tvos", target_os = "vxworks", @@ -437,7 +437,7 @@ impl From for SockAddr { target_os = "visionos", target_os = "macos", target_os = "netbsd", - target_os = "nto", + all(target_os = "nto", not(target_env = "nto71_iosock")), target_os = "openbsd", target_os = "tvos", target_os = "vxworks", @@ -462,7 +462,7 @@ impl fmt::Debug for SockAddr { target_os = "visionos", target_os = "macos", target_os = "netbsd", - target_os = "nto", + all(target_os = "nto", not(target_env = "nto71_iosock")), target_os = "openbsd", target_os = "tvos", target_os = "vxworks", diff --git a/src/socket.rs b/src/socket.rs index 929a1190..e57070d4 100644 --- a/src/socket.rs +++ b/src/socket.rs @@ -11,7 +11,10 @@ use std::io::{self, Read, Write}; #[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] use std::io::{IoSlice, IoSliceMut}; use std::mem::MaybeUninit; -#[cfg(not(any(target_os = "nto", target_os = "nuttx")))] +#[cfg(not(any( + all(target_os = "nto", not(target_env = "nto71_iosock")), + target_os = "nuttx" +)))] use std::net::Ipv6Addr; use std::net::{self, Ipv4Addr, Shutdown}; #[cfg(any(unix, all(target_os = "wasi", not(target_env = "p1"))))] @@ -1351,7 +1354,7 @@ impl Socket { target_os = "openbsd", target_os = "redox", target_os = "solaris", - target_os = "nto", + all(target_os = "nto", not(target_env = "nto71_iosock")), target_os = "espidf", target_os = "vita", target_os = "cygwin", @@ -1387,7 +1390,7 @@ impl Socket { target_os = "openbsd", target_os = "redox", target_os = "solaris", - target_os = "nto", + all(target_os = "nto", not(target_env = "nto71_iosock")), target_os = "espidf", target_os = "vita", target_os = "cygwin", @@ -1425,7 +1428,7 @@ impl Socket { target_os = "openbsd", target_os = "redox", target_os = "fuchsia", - target_os = "nto", + all(target_os = "nto", not(target_env = "nto71_iosock")), target_os = "espidf", target_os = "vita", target_os = "wasi", @@ -1465,7 +1468,7 @@ impl Socket { target_os = "openbsd", target_os = "redox", target_os = "fuchsia", - target_os = "nto", + all(target_os = "nto", not(target_env = "nto71_iosock")), target_os = "espidf", target_os = "vita", target_os = "wasi", @@ -1708,7 +1711,7 @@ impl Socket { target_os = "redox", target_os = "solaris", target_os = "haiku", - target_os = "nto", + all(target_os = "nto", not(target_env = "nto71_iosock")), target_os = "espidf", target_os = "nuttx", target_os = "vita", @@ -1743,7 +1746,7 @@ impl Socket { target_os = "redox", target_os = "solaris", target_os = "haiku", - target_os = "nto", + all(target_os = "nto", not(target_env = "nto71_iosock")), target_os = "espidf", target_os = "nuttx", target_os = "vita", @@ -1892,7 +1895,10 @@ impl Socket { /// This function specifies a new multicast group for this socket to join. /// The address must be a valid multicast address, and `interface` is the /// index of the interface to join/leave (or 0 to indicate any interface). - #[cfg(not(any(target_os = "nto", target_os = "nuttx")))] + #[cfg(not(any( + all(target_os = "nto", not(target_env = "nto71_iosock")), + target_os = "nuttx" + )))] pub fn join_multicast_v6(&self, multiaddr: &Ipv6Addr, interface: u32) -> io::Result<()> { let mreq = sys::Ipv6Mreq { ipv6mr_multiaddr: sys::to_in6_addr(multiaddr), @@ -1916,7 +1922,10 @@ impl Socket { /// For more information about this option, see [`join_multicast_v6`]. /// /// [`join_multicast_v6`]: Socket::join_multicast_v6 - #[cfg(not(any(target_os = "nto", target_os = "nuttx")))] + #[cfg(not(any( + all(target_os = "nto", not(target_env = "nto71_iosock")), + target_os = "nuttx" + )))] pub fn leave_multicast_v6(&self, multiaddr: &Ipv6Addr, interface: u32) -> io::Result<()> { let mreq = sys::Ipv6Mreq { ipv6mr_multiaddr: sys::to_in6_addr(multiaddr), diff --git a/src/sys/unix.rs b/src/sys/unix.rs index 816fba7e..0f1a2fc5 100644 --- a/src/sys/unix.rs +++ b/src/sys/unix.rs @@ -143,7 +143,10 @@ pub(crate) use libc::MSG_TRUNC; #[cfg(not(any(target_os = "redox", target_os = "wasi")))] pub(crate) use libc::SO_OOBINLINE; // Used in `Socket`. -#[cfg(not(any(target_os = "nto", target_os = "nuttx")))] +#[cfg(not(any( + all(target_os = "nto", not(target_env = "nto71_iosock")), + target_os = "nuttx" +)))] pub(crate) use libc::ipv6_mreq as Ipv6Mreq; #[cfg(all(feature = "all", target_os = "linux"))] pub(crate) use libc::IPV6_HDRINCL; @@ -206,7 +209,7 @@ pub(crate) use libc::IP_HDRINCL; target_os = "solaris", target_os = "haiku", target_os = "hurd", - target_os = "nto", + all(target_os = "nto", not(target_env = "nto71_iosock")), target_os = "espidf", target_os = "nuttx", target_os = "vita", @@ -260,7 +263,7 @@ pub(crate) use libc::{ target_os = "openbsd", target_os = "redox", target_os = "fuchsia", - target_os = "nto", + all(target_os = "nto", not(target_env = "nto71_iosock")), target_os = "espidf", target_os = "vita", target_os = "wasi", @@ -278,7 +281,7 @@ pub(crate) use libc::{ target_os = "visionos", target_os = "macos", target_os = "netbsd", - target_os = "nto", + all(target_os = "nto", target_env = "nto71_iosock"), target_os = "qnx", target_os = "openbsd", target_os = "solaris", @@ -298,6 +301,7 @@ pub(crate) use libc::{IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP}; target_os = "macos", target_os = "netbsd", target_os = "openbsd", + all(target_os = "nto", target_env = "nto71_iosock"), target_os = "qnx", target_os = "solaris", target_os = "tvos", @@ -1335,7 +1339,7 @@ pub(crate) fn set_tcp_keepalive(fd: RawSocket, keepalive: &TcpKeepalive) -> io:: #[cfg(not(any( target_os = "haiku", target_os = "openbsd", - target_os = "nto", + all(target_os = "nto", not(target_env = "nto71_iosock")), target_os = "vita" )))] if let Some(time) = keepalive.time { @@ -1355,6 +1359,7 @@ pub(crate) fn set_tcp_keepalive(fd: RawSocket, keepalive: &TcpKeepalive) -> io:: target_os = "ios", target_os = "visionos", target_os = "linux", + all(target_os = "nto", target_env = "nto71_iosock"), target_os = "qnx", target_os = "macos", target_os = "netbsd", @@ -1375,7 +1380,7 @@ pub(crate) fn set_tcp_keepalive(fd: RawSocket, keepalive: &TcpKeepalive) -> io:: } } - #[cfg(target_os = "nto")] + #[cfg(all(target_os = "nto", not(target_env = "nto71_iosock")))] if let Some(time) = keepalive.time { let secs = into_timeval(Some(time)); unsafe { setsockopt(fd, libc::IPPROTO_TCP, KEEPALIVE_TIME, secs)? } @@ -1387,7 +1392,7 @@ pub(crate) fn set_tcp_keepalive(fd: RawSocket, keepalive: &TcpKeepalive) -> io:: #[cfg(not(any( target_os = "haiku", target_os = "openbsd", - target_os = "nto", + all(target_os = "nto", not(target_env = "nto71_iosock")), target_os = "vita" )))] fn into_secs(duration: Duration) -> c_int { @@ -1493,7 +1498,7 @@ pub(crate) fn from_in6_addr(addr: in6_addr) -> Ipv6Addr { target_os = "openbsd", target_os = "redox", target_os = "solaris", - target_os = "nto", + all(target_os = "nto", not(target_env = "nto71_iosock")), target_os = "espidf", target_os = "vita", target_os = "cygwin",