Hidehito Yabuuchi 5660656e3a Use self short-hand
2018-10-01 11:56:12 +02:00
2018-10-01 11:56:12 +02:00
2018-08-28 14:52:23 +02:00
2018-09-02 15:40:56 +02:00
2018-09-16 14:43:09 +02:00
2018-08-30 00:04:53 +02:00
2018-08-30 00:04:53 +02:00
2018-09-02 15:43:48 +02:00

cgroups-rs Build

Native Rust library for managing control groups under Linux

Example

Create a control group, and limit the pid resource

// Acquire a handle for the V1 cgroup hierarchy.
let hier = ::hierarchies::V1::new();
// Create a control group named "example" in the hierarchy.
let cg = Cgroup::new(&hier, String::from("example"), 0);
{
    // Get a handle to the pids controller of the control group.
    let pids: &PidController = cg.controller_of().expect("No pids controller in V1 hierarchy!");
    // Set the maximum amount of processes in the cgroup.
    pids.set_pid_max(PidMax::Value(10));
    // Check that this has had the desired effect by reading the value back from the kernel.
    assert_eq!(pids.get_pid_max(), Some(PidMax::Value(10)));
}
// Once done, delete the control group (and its associated controllers).
cg.delete();

Disclaimer

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!

Description
No description provided
Readme 678 KiB
Languages
Rust 96.5%
Shell 3.2%
Makefile 0.3%