Skip to content

Commit

Permalink
Add a function for bitness detection on illumos
Browse files Browse the repository at this point in the history
  • Loading branch information
martintc committed Apr 25, 2022
1 parent c38baef commit 215ad21
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions os_info/src/bitness.rs
Expand Up @@ -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(
Expand Down

0 comments on commit 215ad21

Please sign in to comment.