Rust bindings to Linux Control Groups (cgroups)

Overview

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.

You might also like...
Splits test files into multiple groups to run tests in parallel nodes

split-test split-test splits tests into multiple groups based on timing data to run tests in parallel. Installation Download binary from GitHub releas

A simple web-app allowing you to batch archive groups of repositories from a given organization

ice-repos My goal here is to build a simple web-app allowing you to batch archive groups of repositories from a given organization, using Rust+Yew. As

Small program which groups images based on the GPS position.

gps-cluster This small program will take some pictures in input, and based on the metadata on every image, it will group them by their GPS position, i

A Rust program to control bias lighting on Linux and Windows.

displaylight_rs This Rust workspace is a rewrite of my DisplayLight project. It colors leds mounted behind the monitor with the colors shown on the di

A GUI Fan control utility for Linux.

TuxTempMaster For now I'm gonna use this README to write the status of the project Important note This program is not gonna do any black magic. If you

Control Google Pixel Buds Pro from the Linux command line.

pbpctrl Control Google Pixel Buds Pro from the Linux command line. Might or might not work on other Pixel Buds devices. Allows reading of battery, har

TMM is a Linux native game modding tool. it allows to install and depoly mods for Linux native and wine games.

Tux Mod Manager TMM is a Linux native mod manager made with the Tauri toolkit. It can install, load, remove and deploy mods for both Linux native and

Authenticate the cryptographic chain-of-custody of Linux distributions (like Arch Linux and Debian) to their source code inputs

backseat-signed Authenticate the cryptographic chain-of-custody of Linux distributions (like Arch Linux and Debian) to their source code inputs. This

⬡ Zone of Control is a hexagonal turn-based strategy game written in Rust. [DISCONTINUED]
⬡ Zone of Control is a hexagonal turn-based strategy game written in Rust. [DISCONTINUED]

Zone of Control The project is discontinued Sorry, friends. ZoC is discontinued. See https://ozkriff.github.io/2017-08-17--devlog.html Downloads Preco

link is a command and control framework written in rust
link is a command and control framework written in rust

link link is a command and control framework written in rust. Currently in alpha. Table of Contents Introduction Features Feedback Build Process Ackno

Optimistic multi-version concurrency control (MVCC) for main memory databases, written in Rust.

MVCC for Rust This is a work-in-progress the Hekaton optimistic multiversion concurrency control library in Rust. The aim of the project is to provide

A version control system implemented from scratch in Rust.

Version Control An experiment to write a version control system from scratch in Rust. CLI Usage Usage: revtool COMMAND Commands: init initia

REC2 (Rusty External Command and Control) is client and server tool allowing auditor to execute command from VirusTotal and Mastodon APIs written in Rust. 🦀
REC2 (Rusty External Command and Control) is client and server tool allowing auditor to execute command from VirusTotal and Mastodon APIs written in Rust. 🦀

Information: REC2 is an old personal project (early 2023) that I didn't continue development on. It's part of a list of projects that helped me to lea

An over-simplified version control system written in Rust, similar to Git, for local files (Incomplete)

Vault Vault will be a command line tool (if successful) similar to git which would have multiple features like brances etc etc. __ __ _ _

A command and control framework written in rust.
A command and control framework written in rust.

Tempest Tempest is a command and control framework written in 100% Rust. blog post: https://teach2breach.io/tempest-intro/ slides: https://teach2breac

Daemon and tools to control your ASUS ROG laptop. Supersedes rog-core.

asusctl for ASUS ROG - Asus Linux Website asusd is a utility for Linux to control many aspects of various ASUS laptops but can also be used with non-a

The CLI to control StewardX
The CLI to control StewardX

StewardX CLI Logo converted to ASCII via https://asciiart.club/ The CLI to control StewardX This is the official CLI to control StewardX. Made with #c

Drop-in Access Control via NFT Ownership
Drop-in Access Control via NFT Ownership

niftygate - Signature-Based Authenticating Proxy What is it? niftygate is a proxy for HTTP services, that validates signatures, providing an AuthN lay

Comments
  • Some questions about blkio Cgroup

    Some questions about blkio Cgroup

    Hello everyone,I am a gree hand of Cgroup!About blkio Cgroup.I learned that the blkio Cgroup only controls the direct io of process.But,my question is that how the blkio Cgroup limit the iops of processes?How the blkio Cgroup caculate the iops of a process?How the blkio Cgroup collection the information about iops of processes?If I want to read the source code of blkio Cgroup and understand it,where is the location?I would be grateful if you could give me some suggestion!Thans a lot!

    opened by younaman 1
Owner
Vlad Frolov
:wq
Vlad Frolov
Rust bindings for iptables

Rust iptables This crate provides bindings for iptables application in Linux (inspired by go-iptables). This crate uses iptables binary to manipulate

Navid 63 Nov 17, 2022
Rust friendly bindings to *nix APIs

Rust bindings to *nix APIs Documentation (Releases) Nix seeks to provide friendly bindings to various *nix platform APIs (Linux, Darwin, ...). The goa

null 2k Jan 4, 2023
Rust bindings to Windows API

winapi-rs Documentation Official communication channel: #windows-dev on the Rust Community Discord This crate provides raw FFI bindings to all of Wind

Peter Atashian 1.6k Jan 1, 2023
Rust bindings for the FreeBSD capsicum framework

capsicum Contain the awesome! Rust bindings for the FreeBSD capsicum framework for OS capability and sandboxing Prerequisites Rust, Cargo, and FreeBSD

Dan Robertson 52 Dec 5, 2022
Idiomatic inotify wrapper for the Rust programming language

inotify-rs Idiomatic inotify wrapper for the Rust programming language. extern crate inotify; use std::env; use inotify::{ EventMask, Watch

Hanno Braun 220 Dec 26, 2022
Rust library for filesystems in userspace (FUSE)

Rust FUSE - Filesystem in Userspace About fuse-rs is a Rust library crate for easy implementation of FUSE filesystems in userspace. fuse-rs does not j

Andreas Neuhaus 916 Jan 9, 2023
Rust implementation of a FreeBSD jail library

libjail-rs libjail-rs aims to be a rust implementation of the FreeBSD jail(3) library. While feature parity is a goal, a one-to-one implementation of

fubarnetes 38 Sep 27, 2022
An EVM low-level language that gives full control over the control flow of the smart contract.

Meplang - An EVM low-level language Meplang is a low-level programming language that produces EVM bytecode. It is designed for developers who need ful

MEP 19 Jan 31, 2023
Library for Unix users and groups in Rust.

uzers-rs Adoption and continuation of the unmaintained ogham/rust-users crate. Big shout-out to its creator Benjamin Sago. This is a library for acces

null 8 Aug 25, 2023
Library for Unix users and groups in Rust.

uzers-rs Adoption and continuation of the unmaintained ogham/rust-users crate. Big shout-out to its creator Benjamin Sago. This is a library for acces

null 8 Sep 18, 2023