package
1.2.4
Repository: https://github.com/opencontainers/runc.git
Documentation: pkg.go.dev

# Packages

Package devices contains functionality to manage cgroup devices, which is exposed indirectly via libcontainer/cgroups managers.

# 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.
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.
GetPids returns all pids, that were added to cgroup at path.
IsCgroup2HybridMode returns whether we are running in cgroup v2 hybrid mode.
IsCgroup2UnifiedMode returns whether we are running in cgroup v2 unified mode.
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.
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

# Variables

DevicesSetV1 and DevicesSetV2 are functions to set devices for cgroup v1 and v2, respectively.
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.
TestMode is set to true by unit tests that need "fake" cgroupfs.

# Structs

# Interfaces