Skip to content

Commit

Permalink
small change to fix builds on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
ahl committed Sep 26, 2024
1 parent 516dabe commit 3052dc3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/viona-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,14 @@ impl VionaFd {
}

/// Retrieve the minor number of the viona device instance.
/// This is used for matching kernal statistic entries to the viona device.
/// This is used for matching kernel statistic entries to the viona device.
pub fn instance_id(&self) -> Result<u32> {
let meta = self.0.metadata()?;
let rdev = meta.rdev();
#[cfg(not(target_os = "macos"))]
let minor = unsafe { libc::minor(rdev) };
#[cfg(target_os = "macos")]
let minor = unsafe { libc::minor(rdev as libc::dev_t) as u32 };
Ok(minor)
}

Expand Down

0 comments on commit 3052dc3

Please sign in to comment.