This crate provides a safe interface for reading and writing information to the kernel using the sysctl interface.

Current Version

FreeBSD, Linux and macOS are supported. Contributions for improvements and other platforms are welcome.

Documentation

Documentation is available here: https://johalun.github.io/sysctl-rs/

or, to generate documentation locally do: sh $ git clone https://github.com/johalun/sysctl-rs && cd sysctl-rs $ cargo doc --no-deps $ firefox target/doc/sysctl/index.html

Usage

Add to Cargo.toml

toml [dependencies] sysctl = "0.4.0"

macOS

Example

sysctl comes with several examples, see the examples folder:

Run with:

sh $ cargo run --example iterate

Or to use in your program:

```rust extern crate sysctl; use sysctl::Sysctl;

fn main() { let ctl = sysctl::Ctl::new("kern.osrevision").unwrap(); println!("Description: {}", ctl.description().unwrap()); println!("Value: {}", ctl.value_string().unwrap()); } ```