Rust bindings for illumos libtopo, the hardware topology library used by FMA (Fault Management Architecture) and other illumos consumers.
This repo contains two crates:
- libtopo-sys — raw FFI bindings generated by bindgen
- libtopo — idiomatic Rust wrapper with no raw pointers in the public API
These crates target illumos only and link against the system libtopo.
use libtopo::{Scheme, TopoHdl, WalkAction};
let hdl = TopoHdl::open()?;
let snap = hdl.snapshot()?;
snap.walk(Scheme::Hc, |node| {
let fmri = node.resource()?;
println!("{}[{}]\t{}", node.name(), node.instance(), hdl.fmri_to_string(&fmri)?);
Ok(WalkAction::Continue)
})?;See libtopo/examples/ for runnable programs.
Most libtopo operations require elevated privileges to enumerate
hardware. Run with pfexec or appropriate RBAC profiles.
pfexec cargo testTests must be run on an illumos host since they link against libtopo.