Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
cgroup.hh File Reference
#include <chrono>
#include <optional>
#include <filesystem>
#include "nix/util/types.hh"
#include "nix/util/canon-path.hh"

Go to the source code of this file.

Classes

struct  nix::linux::CgroupStats

Functions

std::optional< std::filesystem::path > nix::linux::getCgroupFS ()
StringMap nix::linux::getCgroups (const std::filesystem::path &cgroupFile)
CgroupStats nix::linux::getCgroupStats (const std::filesystem::path &cgroup)
CgroupStats nix::linux::destroyCgroup (const std::filesystem::path &cgroup)
CanonPath nix::linux::getCurrentCgroup ()
CanonPath nix::linux::getRootCgroup ()
void nix::linux::setRootCgroup (CanonPath cgroup)

Function Documentation

◆ destroyCgroup()

CgroupStats nix::linux::destroyCgroup ( const std::filesystem::path & cgroup)

Destroy the cgroup denoted by 'path'. The postcondition is that 'path' does not exist, and thus any processes in the cgroup have been killed. Also return statistics from the cgroup just before destruction.

◆ getCgroupStats()

CgroupStats nix::linux::getCgroupStats ( const std::filesystem::path & cgroup)

Read statistics from the given cgroup.

◆ getRootCgroup()

CanonPath nix::linux::getRootCgroup ( )

Get the cgroup that should be used as the parent when creating new sub-cgroups. The first time this is called, the current cgroup will be returned, and then all subsequent calls will return the original cgroup.

◆ setRootCgroup()

void nix::linux::setRootCgroup ( CanonPath cgroup)

Make getRootCgroup() return cgroup. A process that does not start in the root cgroup, such as a daemon worker, calls this before anything calls getRootCgroup(). It is not synchronised.