diff --git a/os_info/src/bitness.rs b/os_info/src/bitness.rs index 28b6d0ce..16b4dc76 100644 --- a/os_info/src/bitness.rs +++ b/os_info/src/bitness.rs @@ -78,6 +78,19 @@ pub fn get() -> Bitness { } } +#[cfg(target_os = "illumos")] +pub fn get() -> Bitness { + match &Command::new("uname").arg("-p").output() { + Ok(Output { stdout, .. }) if stdout == b"amd64\n" => Bitness::X64, + Ok(Output { stdout, .. }) if stdout == b"x86_64\n" => Bitness::X64, + Ok(Output { stdout, .. }) if stdout == b"i386\n" => Bitness::X32, + Ok(Output { stdout, .. }) if stdout == b"aarch64\n" => Bitness::X64, + Ok(Output { stdout, .. }) if stdout == b"earmv7hf\n" => Bitness::X32, + Ok(Output { stdout, .. }) if stdout == b"sparc64\n" => Bitness::X64, + _ => Bitness::Unknown, + } +} + #[cfg(all( test, any(