Skip to content

oxidecomputer/libtopo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libtopo

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.

Usage

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.

Privileges

Most libtopo operations require elevated privileges to enumerate hardware. Run with pfexec or appropriate RBAC profiles.

Testing

pfexec cargo test

Tests must be run on an illumos host since they link against libtopo.

About

Rust bindings for illumos libtopo

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages