Skip to content

Commit be1d0ad

Browse files
committed
Add GNU/Hurd support
Signed-off-by: Samuel Thibault <[email protected]>
1 parent 35808a4 commit be1d0ad

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

.github/workflows/tests.yml

+2
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,8 @@ jobs:
303303
# `std` support still in progress. Can be moved up with the other
304304
# apple targets after https://github.com/rust-lang/rust/pull/103503
305305
aarch64-apple-tvos,
306+
# `std` support being commited, see https://github.com/rust-lang/rust/pull/116527
307+
i686-unknown-hurd-gnu,
306308
]
307309
include:
308310
# Supported tier 3 targets with libstd support

src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
//! | Redox | `*‑redox` | `/dev/urandom`
2626
//! | Haiku | `*‑haiku` | `/dev/urandom` (identical to `/dev/random`)
2727
//! | Hermit | `*-hermit` | [`sys_read_entropy`]
28+
//! | Hurd | `*-hurd-gnu` | `/dev/urandom`
2829
//! | SGX | `x86_64‑*‑sgx` | [`RDRAND`]
2930
//! | VxWorks | `*‑wrs‑vxworks‑*` | `randABytes` after checking entropy pool initialization with `randSecure`
3031
//! | ESP-IDF | `*‑espidf` | [`esp_fill_random`]
@@ -216,7 +217,7 @@ pub use crate::error::Error;
216217
// The function MUST NOT ever write uninitialized bytes into `dest`,
217218
// regardless of what value it returns.
218219
cfg_if! {
219-
if #[cfg(any(target_os = "haiku", target_os = "redox", target_os = "nto", target_os = "aix"))] {
220+
if #[cfg(any(target_os = "haiku", target_os = "hurd", target_os = "redox", target_os = "nto", target_os = "aix"))] {
220221
mod util_libc;
221222
#[path = "use_file.rs"] mod imp;
222223
} else if #[cfg(any(target_os = "android", target_os = "linux"))] {

src/use_file.rs

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const FILE_PATH: &str = "/dev/random\0";
3131
target_os = "redox",
3232
target_os = "dragonfly",
3333
target_os = "haiku",
34+
target_os = "hurd",
3435
target_os = "macos",
3536
target_os = "nto",
3637
))]

src/util_libc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use libc::c_void;
1919
cfg_if! {
2020
if #[cfg(any(target_os = "netbsd", target_os = "openbsd", target_os = "android"))] {
2121
use libc::__errno as errno_location;
22-
} else if #[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "redox"))] {
22+
} else if #[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "hurd", target_os = "redox"))] {
2323
use libc::__errno_location as errno_location;
2424
} else if #[cfg(any(target_os = "solaris", target_os = "illumos"))] {
2525
use libc::___errno as errno_location;

0 commit comments

Comments
 (0)