rsys 0.5.5

Crate for system and hardware information parsing
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use super::{run, Command, VM_PAGESIZE};
use crate::{Error, Result};

pub(crate) fn sysctl(property: &str) -> Result<String> {
    run(Command::new("sysctl").arg("-n").arg(property))
}

pub(crate) fn vm_pagesize() -> Result<u32> {
    Ok(sysctl(VM_PAGESIZE)?
        .parse::<u32>()
        .map_err(|e| Error::CommandParseError(e.to_string()))?)
}