Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frol/cgroups-fs
Rust bindings to Linux Control Groups (cgroups)
https://github.com/frol/cgroups-fs
cgroups linux rust rust-crate rust-library
Last synced: 8 days ago
JSON representation
Rust bindings to Linux Control Groups (cgroups)
- Host: GitHub
- URL: https://github.com/frol/cgroups-fs
- Owner: frol
- License: apache-2.0
- Created: 2018-12-25T21:23:10.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-06-12T07:04:24.000Z (over 2 years ago)
- Last Synced: 2024-10-10T20:22:29.775Z (25 days ago)
- Topics: cgroups, linux, rust, rust-crate, rust-library
- Language: Rust
- Size: 18.6 KB
- Stars: 32
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
- awesome-rust-cn - frol/cgroups-fs - ci.org/frol/cgroups-fs.svg?branch=master">](https://travis-ci.org/frol/cgroups-fs) (Libraries / Platform specific)
- awesome-rust - frol/cgroups-fs - ci.org/frol/cgroups-fs.svg?branch=master">](https://travis-ci.org/frol/cgroups-fs) (Libraries / Platform specific)
- awesome-rust-zh - frol/cgroups-fs - Rust 绑定 Linux 控制组(CGroups)[<img src="https://api.travis-ci.org/frol/cgroups-fs.svg?branch=master">](https://travis-ci.org/frol/cgroups-fs) (库 / 平台特定)
README
# cgroups-fs [![crates.io](https://meritbadge.herokuapp.com/cgroups-fs)](https://crates.io/crates/cgroups-fs) [![Documentation](https://docs.rs/cgroups-fs/badge.svg)](https://docs.rs/cgroups-fs) [![Build Status](https://travis-ci.org/frol/cgroups-fs.svg?branch=master)](https://travis-ci.org/frol/cgroups-fs)
Native Rust library for managing Linux Control Groups (cgroups).
This crate, curently, only supports the original, V1 hierarchy. You are welcome to contribute
Cgroups V2 support.## Prior art
* [cgroups](https://crates.io/crates/cgroups) - it does too many things (e.g. creates cgroups in
the subsystems that I don't plan to use, parses control files that I don't plan to use).## Usage
First, add the following to your `Cargo.toml`:
```toml
[dependencies]
cgroups-fs = "1.0"
```Next, use it in your crate:
```rust
use cgroups_fs;
```## Examples
```rust
use cgroups_fs;let my_cgroup = cgroups_fs::CgroupName("my-cgroup");
let my_cpu_cgroup = cgroups_fs::Cgroup::init(&my_cgroup, "cpu")?;
println!(
"The current CPU shares in `my-cgroup` control group is {}",
my_cpu_cgroup.get_value::("cpu.shares")
);
```Please, find more examples in [the documentation](https://docs.rs/cgroups-fs#examples).
## License
This project is licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0))
* MIT license ([LICENSE-MIT](LICENSE-MIT) or [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT))at your option.