From 049025306aa9e04f82cbc5365c8c71cb72d284d3 Mon Sep 17 00:00:00 2001 From: Cris Sinnott Date: Wed, 11 Nov 2026 14:27:42 -0500 Subject: [PATCH] Add QNX (target_os = "qnx") support to use_file backend QNX systems support a custom target triple `x86_64-pc-qnx` where target_os is "qnx" (distinct from the existing "nto" used by the standard `x86_64-pc-nto-qnx8.0.0` triple). Both "nto" and "qnx" refer to QNX operating systems and use the same APIs: /dev/urandom for randomness and libc::__get_errno_ptr for errno. Changes: - backends.rs: add target_os = "qnx" to the use_file backend cfg block - utils/get_errno.rs: add target_os = "qnx" to the __get_errno_ptr branch - Cargo.toml: add target_os = "qnx" to the use_file libc dependency cfg --- Cargo.toml | 2 +- src/backends.rs | 1 + src/utils/get_errno.rs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index af064432..6f5e7302 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -73,7 +73,7 @@ libc = { version = "0.2.176", default-features = false } libc = { version = "0.2.190", default-features = false } # use_file -[target.'cfg(any(target_os = "haiku", target_os = "nto", target_os = "aix"))'.dependencies] +[target.'cfg(any(target_os = "haiku", target_os = "nto", target_os = "qnx", target_os = "aix"))'.dependencies] libc = { version = "0.2.176", default-features = false } # vxworks diff --git a/src/backends.rs b/src/backends.rs index d644ab62..d1a70bde 100644 --- a/src/backends.rs +++ b/src/backends.rs @@ -44,6 +44,7 @@ cfg_if! { } else if #[cfg(any( target_os = "haiku", target_os = "nto", + target_os = "qnx", target_os = "aix", ))] { mod use_file; diff --git a/src/utils/get_errno.rs b/src/utils/get_errno.rs index 2c68ef9e..5fbe185e 100644 --- a/src/utils/get_errno.rs +++ b/src/utils/get_errno.rs @@ -9,7 +9,7 @@ cfg_if! { use libc::__error as errno_location; } else if #[cfg(target_os = "haiku")] { use libc::_errnop as errno_location; - } else if #[cfg(target_os = "nto")] { + } else if #[cfg(any(target_os = "nto", target_os = "qnx"))] { use libc::__get_errno_ptr as errno_location; } else if #[cfg(any(all(target_os = "horizon", target_arch = "arm"), target_os = "vita"))] { unsafe extern "C" {