diff --git a/src/lib.rs b/src/lib.rs index d7f67722..e54fbebb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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"))] { diff --git a/src/use_file.rs b/src/use_file.rs index 16c0216b..96ac8eac 100644 --- a/src/use_file.rs +++ b/src/use_file.rs @@ -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> { diff --git a/src/util_libc.rs b/src/util_libc.rs index d057071a..acaa9f25 100644 --- a/src/util_libc.rs +++ b/src/util_libc.rs @@ -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; } }