Skip to content

Add z/OS (s390x-ibm-zos) support via use_file backend - #859

Closed
IgorTodorovskiIBM wants to merge 1 commit into
rust-random:masterfrom
IgorTodorovskiIBM:itodorov/zos-support
Closed

Add z/OS (s390x-ibm-zos) support via use_file backend#859
IgorTodorovskiIBM wants to merge 1 commit into
rust-random:masterfrom
IgorTodorovskiIBM:itodorov/zos-support

Conversation

@IgorTodorovskiIBM

@IgorTodorovskiIBM IgorTodorovskiIBM commented Aug 9, 2026

Copy link
Copy Markdown

Summary

Add z/OS support using the existing use_file backend (/dev/urandom).

z/OS is a Rust tier-2 target (s390x-ibm-zos). Like AIX, it has /dev/urandom available (z/OS 2.1+) and uses __errno() for errno access.

Changes

src/backends.rs: Add target_os = "zos" to the use_file backend group (alongside aix, haiku, redox, nto).

src/utils/get_errno.rs: Add target_os = "zos" to the __errno group (alongside netbsd, openbsd, android, cygwin). z/OS provides __errno() returning *mut c_int.

Cargo.toml: Add target_os = "zos" to the use_file libc target dependency.

Testing

Tested with cargo check --target s390x-ibm-zos using the IBM libc fork.

Note: until IBM's z/OS libc PR lands in crates.io libc, cross-compilation requires the IBM libc fork. Once upstream libc supports z/OS, this will work out of the box.

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.
@newpavlov

Copy link
Copy Markdown
Member

Has the target landed on Nightly? It's not yet listed here.

It's also worth to at least check build for the target as part of our CI, so it's probably worth to wait until the libc changes land.

Fix the compiler warnings by adding #[allow(unexpected_cfgs, reason = "z/OS is not known on MSRV")] and add a changelog entry:

## [0.4.4] - UNRELEASED
### Added
- z/OS (`s390x-ibm-zos`) support via `use_file` backend ([#859])

[0.4.4]: https://github.com/rust-random/getrandom/compare/v0.4.3...master
[#859]: https://github.com/rust-random/getrandom/pull/859

@newpavlov

newpavlov commented Aug 11, 2026

Copy link
Copy Markdown
Member

It looks like the target is not implemented yet, so this PR is premature.

@newpavlov newpavlov closed this Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants