#linux #cgroup #containers #isolation


Native Rust crate for managing control groups on Linux

3 unstable releases

Uses old Rust 2015

0.1.0 Dec 23, 2018
0.0.2 Sep 3, 2018
0.0.1 Aug 29, 2018

#248 in Unix APIs

Download history 82/week @ 2022-10-08 116/week @ 2022-10-15 148/week @ 2022-10-22 128/week @ 2022-10-29 91/week @ 2022-11-05 177/week @ 2022-11-12 211/week @ 2022-11-19 181/week @ 2022-11-26 198/week @ 2022-12-03 300/week @ 2022-12-10 132/week @ 2022-12-17 40/week @ 2022-12-24 128/week @ 2022-12-31 206/week @ 2023-01-07 173/week @ 2023-01-14 112/week @ 2023-01-21

630 downloads per month



cgroups-rs Build

Native Rust library for managing control groups under Linux

Right now the crate only support the original, V1 hierarchy, however support is planned for the Unified hierarchy.


Create a control group using the builder pattern

// Acquire a handle for the V1 cgroup hierarchy.
let hier = ::hierarchies::V1::new();

// Use the builder pattern (see the documentation to create the control group)
// This creates a control group named "example" in the V1 hierarchy.
let cg: Cgroup = CgroupBuilder::new("example", &v1)

// Now `cg` is a control group that gets 85% of the CPU time in relative to
// other control groups.

// Get a handle to the CPU controller.
let cpus: &CpuController = cg.controller_of().unwrap();

// [...]

// Finally, clean up and delete the control group.

// Note that `Cgroup` does not implement `Drop` and therefore when the
// structure is dropped, the Cgroup will stay around. This is because, later
// you can then re-create the `Cgroup` using `load()`. We aren't too set on
// this behavior, so it might change in the feature. Rest assured, it will be a
// major version change.


This crate is licensed under:

  • MIT License (see LICENSE-MIT); or
  • Apache 2.0 License (see LICENSE-Apache-2.0),

at your option.

Please note that this crate is under heavy development, we will use sematic versioning, but during the 0.0.* phase, no guarantees are made about backwards compatibility.

Regardless, check back often and thanks for taking a look!