From 631c521c6304573055081a1fee559da122a522bf Mon Sep 17 00:00:00 2001 From: Igor Todorovski Date: Sun, 9 Aug 2026 14:12:05 -0400 Subject: [PATCH] Add z/OS (s390x-ibm-zos) support z/OS is a Rust tier-2 target (s390x-ibm-zos) that has /dev/urandom available (z/OS 2.1+). Use the existing use_file backend, the same as AIX, Haiku, Redox, and NTO. Changes: - src/backends.rs: add target_os = "zos" to the use_file backend group - src/utils/get_errno.rs: add target_os = "zos" to the __errno group (z/OS uses __errno() same as Android/NetBSD/OpenBSD) - Cargo.toml: add target_os = "zos" to the use_file libc dependency Tested: cargo check --target s390x-ibm-zos passes with IBM libc fork. --- 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 0e488c4d2..638f780d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -69,7 +69,7 @@ libc = { version = "0.2.154", default-features = false } libc = { version = "0.2.154", default-features = false } # use_file -[target.'cfg(any(target_os = "haiku", target_os = "redox", target_os = "nto", target_os = "aix"))'.dependencies] +[target.'cfg(any(target_os = "haiku", target_os = "redox", target_os = "nto", target_os = "aix", target_os = "zos"))'.dependencies] libc = { version = "0.2.154", default-features = false } # vxworks diff --git a/src/backends.rs b/src/backends.rs index 86ffd7579..33aead4ad 100644 --- a/src/backends.rs +++ b/src/backends.rs @@ -46,6 +46,7 @@ cfg_if! { target_os = "redox", target_os = "nto", target_os = "aix", + target_os = "zos", ))] { mod use_file; pub use use_file::*; diff --git a/src/utils/get_errno.rs b/src/utils/get_errno.rs index 1895fc05e..ceff150c5 100644 --- a/src/utils/get_errno.rs +++ b/src/utils/get_errno.rs @@ -1,5 +1,5 @@ cfg_if! { - if #[cfg(any(target_os = "netbsd", target_os = "openbsd", target_os = "android", target_os = "cygwin"))] { + if #[cfg(any(target_os = "netbsd", target_os = "openbsd", target_os = "android", target_os = "cygwin", target_os = "zos"))] { use libc::__errno as errno_location; } else if #[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "hurd", target_os = "redox", target_os = "dragonfly"))] { use libc::__errno_location as errno_location;