Skip to content

Rust bindings to Linux Control Groups (cgroups)

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

frol/cgroups-fs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cgroups-fs crates.io Documentation Build Status

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 - 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:

[dependencies]
cgroups-fs = "1.0"

Next, use it in your crate:

use cgroups_fs;

Examples

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::<u64>("cpu.shares")
);

Please, find more examples in the documentation.

License

This project is licensed under either of

at your option.

About

Rust bindings to Linux Control Groups (cgroups)

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages