https://github.com/kpcyrd/kmod-rs
Bindings to libkmod to manage linux kernel modules
https://github.com/kpcyrd/kmod-rs
ffi-wrapper rust
Last synced: 9 months ago
JSON representation
Bindings to libkmod to manage linux kernel modules
- Host: GitHub
- URL: https://github.com/kpcyrd/kmod-rs
- Owner: kpcyrd
- License: apache-2.0
- Created: 2018-03-05T15:27:36.000Z (almost 8 years ago)
- Default Branch: main
- Last Pushed: 2022-12-06T12:16:25.000Z (about 3 years ago)
- Last Synced: 2025-03-28T03:12:31.821Z (10 months ago)
- Topics: ffi-wrapper, rust
- Language: Rust
- Homepage: https://docs.rs/kmod/
- Size: 47.9 KB
- Stars: 13
- Watchers: 2
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# kmod-rs [![Build Status][travis-img]][travis] [![crates.io][crates-img]][crates] [![docs.rs][docs-img]][docs]
[travis-img]: https://travis-ci.org/kpcyrd/kmod-rs.svg?branch=master
[travis]: https://travis-ci.org/kpcyrd/kmod-rs
[crates-img]: https://img.shields.io/crates/v/kmod.svg
[crates]: https://crates.io/crates/kmod
[docs-img]: https://docs.rs/kmod/badge.svg
[docs]: https://docs.rs/kmod
Bindings to libkmod to manage linux kernel modules.
```
# Cargo.toml
[dependencies]
kmod = "0.4"
```
To get started, see the [docs] and the examples/ folder.
```rust
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