modulepackage
0.0.0-20250228075113-afa9f8f3e672
Repository: https://github.com/opencontainers/cgroups.git
Documentation: pkg.go.dev
# README
OCI Project Template
Useful boilerplate and organizational information for all OCI projects.
# Packages
Package devices contains functionality to manage cgroup devices, which is exposed indirectly via libcontainer/cgroups managers.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Functions
Since the OCI spec is designed for cgroup v1, in some cases there is need to convert from the cgroup v1 configuration to cgroup v2 the formula for BlkIOWeight to IOWeight is y = (1 + (x - 10) * 9999 / 990) convert linearly from [10-1000] to [1-10000].
Since the OCI spec is designed for cgroup v1, in some cases there is need to convert from the cgroup v1 configuration to cgroup v2 the formula for cpuShares is y = (1 + ((x - 2) * 9999) / 262142) convert from [2-262144] to [1-10000] 262144 comes from Linux kernel definition "#define MAX_SHARES (1UL << 18)".
ConvertMemorySwapToCgroupV2Value converts MemorySwap value from OCI spec for use by cgroup v2 drivers.
https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt.
No description provided by the author
GetAllPids returns all pids from the cgroup identified by path, and all its sub-cgroups.
GetAllSubsystems returns all the cgroup subsystems supported by the kernel.
GetCgroupMounts returns the mounts for the cgroup subsystems.
GetOwnCgroup returns the relative path to the cgroup docker is running in.
No description provided by the author
GetPids returns all pids, that were added to cgroup at path.
No description provided by the author
IsCgroup2HybridMode returns whether we are running in cgroup v2 hybrid mode.
IsCgroup2UnifiedMode returns whether we are running in cgroup v2 unified mode.
No description provided by the author
No description provided by the author
No description provided by the author
NewThrottleDevice returns a configured ThrottleDevice pointer.
NewWeightDevice returns a configured WeightDevice pointer.
OpenFile opens a cgroup file in a given dir with given flags.
ParseCgroupFile parses the given cgroup file, typically /proc/self/cgroup or /proc/<pid>/cgroup, into a map of subsystems to cgroup paths, e.g.
No description provided by the author
ReadFile reads data from a cgroup file in dir.
RemovePath aims to remove cgroup path.
RemovePaths iterates over the provided paths removing them.
WriteCgroupProc writes the specified pid into the cgroup's cgroup.procs file.
WriteFile writes data to a cgroup file in dir.
WriteFileByLine is the same as WriteFile, except if data contains newlines, it is written line by line.
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
DevicesSetV1 and DevicesSetV2 are functions to set devices for cgroup v1 and v2, respectively.
No description provided by the author
ErrDevicesUnsupported is an error returned when a cgroup manager is not configured to set device rules.
ErrRootless is returned by [Manager.Apply] when there is an error creating cgroup directory, and cgroup.Rootless is set.
No description provided by the author
TestMode is set to true by unit tests that need "fake" cgroupfs.
# Structs
No description provided by the author
No description provided by the author
BlockIODevice holds major:minor format supported in blkio cgroup.
Cgroup holds properties of a cgroup on Linux.
No description provided by the author
No description provided by the author
CpuUsage denotes the usage of a CPU.
No description provided by the author
No description provided by the author
No description provided by the author
LinuxRdma for Linux cgroup 'rdma' resource management (Linux 4.11).
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ThrottleDevice struct holds a `major:minor rate_per_second` pair.
No description provided by the author
WeightDevice struct holds a `major:minor weight`|`major:minor leaf_weight` pair.
# Interfaces
No description provided by the author
# Type aliases
No description provided by the author