3个不稳定版本

使用旧的Rust 2015

0.1.0 2018年12月23日
0.0.2 2018年9月3日
0.0.1 2018年8月29日

Unix API 中排名第 588

Download history 44/week @ 2024-03-10 70/week @ 2024-03-17 55/week @ 2024-03-24 101/week @ 2024-03-31 43/week @ 2024-04-07 55/week @ 2024-04-14 55/week @ 2024-04-21 87/week @ 2024-04-28 53/week @ 2024-05-05 53/week @ 2024-05-12 74/week @ 2024-05-19 50/week @ 2024-05-26 51/week @ 2024-06-02 25/week @ 2024-06-09 45/week @ 2024-06-16 36/week @ 2024-06-23

每月下载量 159

MIT/Apache

180KB
4K SLoC

cgroups-rs Build

Linux下管理控制组的原生Rust库

目前该包仅支持原始的V1层次结构,但计划支持统一的层次结构。

示例

使用构建器模式创建控制组

// 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)
	.cpu()
		.shares(85)
		.done()
	.build();

// 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();
cpus.add_task(1234u64);

// [...]

// Finally, clean up and delete the control group.
cg.delete();

// 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.

免责声明

本包的许可协议为

  • MIT许可协议(见LICENSE-MIT);或
  • Apache 2.0许可协议(见LICENSE-Apache-2.0),

任选其一。

请注意,本包处于高度开发中,我们将使用语义版本控制,但在0.0.*阶段,不保证向后兼容性。

无论如何,请经常查看,感谢您查看!

依赖项

~88KB