8 releases (4 breaking)

0.5.0 Dec 6, 2022
0.4.0 Aug 1, 2019
0.3.2 Jun 25, 2019
0.3.1 Mar 10, 2018
0.1.0 Mar 5, 2018

#492 in Unix APIs

29 downloads per month

MIT/Apache

20KB
317 lines

kmod-rs Build Status crates.io docs.rs

Bindings to libkmod to manage linux kernel modules.

# Cargo.toml
[dependencies]
kmod = "0.4"

To get started, see the docs and the examples/ folder.

extern crate kmod;
extern crate env_logger;

fn main() {
    env_logger::init();

    let ctx = kmod::Context::new().expect("kmod ctx failed");

    for module in ctx.modules_loaded().unwrap() {
        let name = module.name();
        let refcount = module.refcount();
        let size = module.size();

        let holders: Vec<_> = module.holders()
                                .map(|x| x.name().to_owned())
                                .collect();

        println!("{:<19} {:8}  {} {:?}", name, size, refcount, holders);
    }
}

License

MIT/Apache-2.0

Dependencies

~0.4–2.8MB
~55K SLoC