Skip to content

Commit 9e897e3

Browse files
committed
Support random file of AIX
1 parent d3aa089 commit 9e897e3

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ pub use crate::error::Error;
188188
// These should all provide getrandom_inner with the same signature as getrandom.
189189
cfg_if! {
190190
if #[cfg(any(target_os = "emscripten", target_os = "haiku",
191-
target_os = "redox"))] {
191+
target_os = "redox", target_os = "aix"))] {
192192
mod util_libc;
193193
#[path = "use_file.rs"] mod imp;
194194
} else if #[cfg(any(target_os = "android", target_os = "linux"))] {

src/use_file.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ use core::{
2626
target_os = "illumos"
2727
))]
2828
const FILE_PATH: &str = "/dev/random\0";
29-
#[cfg(any(target_os = "android", target_os = "linux", target_os = "redox"))]
29+
#[cfg(any(target_os = "android", target_os = "linux",
30+
target_os = "redox", target_os = "aix"))]
3031
const FILE_PATH: &str = "/dev/urandom\0";
3132

3233
pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {

src/util_libc.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ cfg_if! {
3131
fn __errno() -> *mut libc::c_int;
3232
}
3333
use __errno as errno_location;
34+
} else if #[cfg(target_os = "aix")] {
35+
use libc::_Errno as errno_location;
3436
}
3537
}
3638

0 commit comments

Comments
 (0)