From b350b54be9a0a423dee8059f5e7662b275a04a76 Mon Sep 17 00:00:00 2001 From: Svante Karlsson Date: Sat, 2 May 2026 16:21:36 +0200 Subject: [PATCH 1/3] Split target_os = "nto" cfg by env so io-sock variants use TCP_KEEPIDLE QNX 8.0 (target_env = "nto80") ships only the io-sock network stack, which dropped TCP_KEEPALIVE in favour of the BSD-style TCP_KEEPIDLE. The same applies to QNX 7.1 with the optional io-sock stack (target_env = "nto71_iosock"). Only the legacy io-pkt envs (nto70, nto71) still expose TCP_KEEPALIVE. Restricting the existing target_os = "nto" arms in the two KEEPALIVE_TIME aliases to the io-pkt envs lets io-sock variants fall through to the BSD-style TCP_KEEPIDLE arm that already exists. Requires the matching libc change (rust-lang/libc#5071) to land for the new constants to be visible. --- src/sys/unix.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/sys/unix.rs b/src/sys/unix.rs index 0c2f7eb7..d6eab76e 100644 --- a/src/sys/unix.rs +++ b/src/sys/unix.rs @@ -298,11 +298,17 @@ pub(crate) use libc::{TCP_KEEPCNT, TCP_KEEPINTVL}; // See this type in the Windows file. pub(crate) type Bool = c_int; +// QNX legacy io-pkt stack (nto70, nto71) exposes TCP_KEEPALIVE. +// The newer io-sock stack (nto71_iosock, nto80) replaced it with the +// BSD-style TCP_KEEPIDLE — handle both branches below. #[cfg(any( target_os = "ios", target_os = "visionos", target_os = "macos", - target_os = "nto", + all( + target_os = "nto", + any(target_env = "nto70", target_env = "nto71"), + ), target_os = "tvos", target_os = "watchos", ))] @@ -312,7 +318,10 @@ use libc::TCP_KEEPALIVE as KEEPALIVE_TIME; target_os = "ios", target_os = "visionos", target_os = "macos", - target_os = "nto", + all( + target_os = "nto", + any(target_env = "nto70", target_env = "nto71"), + ), target_os = "openbsd", target_os = "tvos", target_os = "watchos", From 69b5c3eaaf789aee47d42a8b8c6c0e6e83d4e0d0 Mon Sep 17 00:00:00 2001 From: svante karlsson Date: Mon, 4 May 2026 20:29:43 +0200 Subject: [PATCH 2/3] removed comments --- src/sys/unix.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/sys/unix.rs b/src/sys/unix.rs index d6eab76e..1cb6742c 100644 --- a/src/sys/unix.rs +++ b/src/sys/unix.rs @@ -298,9 +298,6 @@ pub(crate) use libc::{TCP_KEEPCNT, TCP_KEEPINTVL}; // See this type in the Windows file. pub(crate) type Bool = c_int; -// QNX legacy io-pkt stack (nto70, nto71) exposes TCP_KEEPALIVE. -// The newer io-sock stack (nto71_iosock, nto80) replaced it with the -// BSD-style TCP_KEEPIDLE — handle both branches below. #[cfg(any( target_os = "ios", target_os = "visionos", From 7609a300556584557e4c25618917ae12e86bb952 Mon Sep 17 00:00:00 2001 From: Svante Karlsson Date: Mon, 4 May 2026 23:02:36 +0200 Subject: [PATCH 3/3] Apply cargo fmt to nto cfg predicates Co-Authored-By: Claude Opus 4.7 (1M context) --- src/sys/unix.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/sys/unix.rs b/src/sys/unix.rs index 1cb6742c..a48a0b69 100644 --- a/src/sys/unix.rs +++ b/src/sys/unix.rs @@ -302,10 +302,7 @@ pub(crate) type Bool = c_int; target_os = "ios", target_os = "visionos", target_os = "macos", - all( - target_os = "nto", - any(target_env = "nto70", target_env = "nto71"), - ), + all(target_os = "nto", any(target_env = "nto70", target_env = "nto71"),), target_os = "tvos", target_os = "watchos", ))] @@ -315,10 +312,7 @@ use libc::TCP_KEEPALIVE as KEEPALIVE_TIME; target_os = "ios", target_os = "visionos", target_os = "macos", - all( - target_os = "nto", - any(target_env = "nto70", target_env = "nto71"), - ), + all(target_os = "nto", any(target_env = "nto70", target_env = "nto71"),), target_os = "openbsd", target_os = "tvos", target_os = "watchos",