other: have dummy fallback for disk I/O for unsupported OSes (#1198)

This commit is contained in:
Clement Tsang 2023-06-11 04:01:14 +00:00 committed by GitHub
parent 13a8e5bf0e
commit 2ba7394ac2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,7 +46,7 @@ pub struct IoData {
pub type IoHarvest = HashMap<String, Option<IoData>>; pub type IoHarvest = HashMap<String, Option<IoData>>;
cfg_if! { cfg_if! {
if #[cfg(not(target_os = "freebsd"))] { if #[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))] {
mod io_counters; mod io_counters;
pub use io_counters::IoCounters; pub use io_counters::IoCounters;
@ -68,6 +68,10 @@ cfg_if! {
Ok(io_hash) Ok(io_hash)
} }
} else if #[cfg(not(target_os = "freebsd"))] {
pub fn get_io_usage() -> anyhow::Result<IoHarvest> {
anyhow::bail!("Unsupported OS");
}
} }
} }