fmd-adm-sys 0.1.0

Raw FFI bindings to illumos libfmd_adm
Documentation
  • Coverage
  • 0%
    0 out of 100 items documented0 out of 9 items with examples
  • Size
  • Source code size: 17.49 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 5.96 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 49s Average build duration of successful builds.
  • all releases: 55s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • oxidecomputer/fmd-adm
    0 0 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • smklein

fmd-adm-sys

Raw Rust FFI bindings to illumos libfmd_adm, the Fault Management Daemon administrative library.

How bindings are generated

The bindings in src/lib.rs are pre-generated by bindgen and checked into source control. Bindgen is not run at build time - build.rs only contains linker directives (cargo:rustc-link-lib=fmd_adm and the library search path).

To regenerate, run generate.sh on an illumos machine with bindgen installed (cargo install bindgen-cli):

./generate.sh

The script runs bindgen with the following flags:

  • --allowlist-function 'fmd_adm_.*' - emit only libfmd_adm functions, not the entire transitive header tree
  • --allowlist-var 'FMD_ADM_.*' and --allowlist-var 'FMD_TYPE_.*' - capture constants like FMD_ADM_VERSION and FMD_TYPE_STRING
  • --raw-line '#![allow(...)]' - prepend an attribute to suppress warnings on the naming conventions that bindgen produces for C typedefs

Keyword renaming

The fmd_stat_t union in the C header contains fields named bool, i32, i64, and str, which are reserved keywords in Rust. Bindgen automatically renames these by appending an underscore: bool_, i32_, i64_, str_.

Linking

The library is at /usr/lib/fm/amd64/libfmd_adm.so on illumos. The .cargo/config.toml at the workspace root sets the runtime library search path via -R/usr/lib/fm/amd64.