Skip to content

Commit

Permalink
Support random file of AIX
Browse files Browse the repository at this point in the history
  • Loading branch information
ecnelises committed Sep 5, 2022
1 parent d3aa089 commit 9e897e3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib.rs
Expand Up @@ -188,7 +188,7 @@ pub use crate::error::Error;
// These should all provide getrandom_inner with the same signature as getrandom.
cfg_if! {
if #[cfg(any(target_os = "emscripten", target_os = "haiku",
target_os = "redox"))] {
target_os = "redox", target_os = "aix"))] {
mod util_libc;
#[path = "use_file.rs"] mod imp;
} else if #[cfg(any(target_os = "android", target_os = "linux"))] {
Expand Down
3 changes: 2 additions & 1 deletion src/use_file.rs
Expand Up @@ -26,7 +26,8 @@ use core::{
target_os = "illumos"
))]
const FILE_PATH: &str = "/dev/random\0";
#[cfg(any(target_os = "android", target_os = "linux", target_os = "redox"))]
#[cfg(any(target_os = "android", target_os = "linux",
target_os = "redox", target_os = "aix"))]
const FILE_PATH: &str = "/dev/urandom\0";

pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
Expand Down
2 changes: 2 additions & 0 deletions src/util_libc.rs
Expand Up @@ -31,6 +31,8 @@ cfg_if! {
fn __errno() -> *mut libc::c_int;
}
use __errno as errno_location;
} else if #[cfg(target_os = "aix")] {
use libc::_Errno as errno_location;
}
}

Expand Down

0 comments on commit 9e897e3

Please sign in to comment.