setup_cgroup_conf (cgroup.rs)

firecracker · infra

Configures Linux cgroups for resource isolation constraints.

// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::collections::{HashMap, HashSet};
use std::fmt::Debug;
use std::fs::{self, File};
use std::io::{BufRead, BufReader};
use std::path::{Path, PathBuf};
use std::process;

use regex::Regex;

use crate::{readln_special, writeln_special, JailerError};

// Holds information on a cgroup mount point discovered on the system
#[derive(Debug)]
struct CgroupMountPoint {
    dir: String,
    options: String,
}

// Holds a cache of discovered mount points and cgroup hierarchies
#[derive(Debug)]
struct CgroupHierarchies {
    hierarchies: HashMap<String, PathBuf>,
    mount_points: Vec<CgroupMountPoint>,
}

impl CgroupHierarch

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key