Skip to content

Commit

Permalink
Add GNU/Hurd support
Browse files Browse the repository at this point in the history
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
  • Loading branch information
sthibaul committed Oct 8, 2023
1 parent 35808a4 commit be1d0ad
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ jobs:
# `std` support still in progress. Can be moved up with the other
# apple targets after https://github.com/rust-lang/rust/pull/103503
aarch64-apple-tvos,
# `std` support being commited, see https://github.com/rust-lang/rust/pull/116527
i686-unknown-hurd-gnu,
]
include:
# Supported tier 3 targets with libstd support
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
//! | Redox | `*‑redox` | `/dev/urandom`
//! | Haiku | `*‑haiku` | `/dev/urandom` (identical to `/dev/random`)
//! | Hermit | `*-hermit` | [`sys_read_entropy`]
//! | Hurd | `*-hurd-gnu` | `/dev/urandom`
//! | SGX | `x86_64‑*‑sgx` | [`RDRAND`]
//! | VxWorks | `*‑wrs‑vxworks‑*` | `randABytes` after checking entropy pool initialization with `randSecure`
//! | ESP-IDF | `*‑espidf` | [`esp_fill_random`]
Expand Down Expand Up @@ -216,7 +217,7 @@ pub use crate::error::Error;
// The function MUST NOT ever write uninitialized bytes into `dest`,
// regardless of what value it returns.
cfg_if! {
if #[cfg(any(target_os = "haiku", target_os = "redox", target_os = "nto", target_os = "aix"))] {
if #[cfg(any(target_os = "haiku", target_os = "hurd", target_os = "redox", target_os = "nto", target_os = "aix"))] {
mod util_libc;
#[path = "use_file.rs"] mod imp;
} else if #[cfg(any(target_os = "android", target_os = "linux"))] {
Expand Down
1 change: 1 addition & 0 deletions src/use_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const FILE_PATH: &str = "/dev/random\0";
target_os = "redox",
target_os = "dragonfly",
target_os = "haiku",
target_os = "hurd",
target_os = "macos",
target_os = "nto",
))]
Expand Down
2 changes: 1 addition & 1 deletion src/util_libc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use libc::c_void;
cfg_if! {
if #[cfg(any(target_os = "netbsd", target_os = "openbsd", target_os = "android"))] {
use libc::__errno as errno_location;
} else if #[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "redox"))] {
} else if #[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "hurd", target_os = "redox"))] {
use libc::__errno_location as errno_location;
} else if #[cfg(any(target_os = "solaris", target_os = "illumos"))] {
use libc::___errno as errno_location;
Expand Down

0 comments on commit be1d0ad

Please sign in to comment.