k3s/vendor/github.com/opencontainers/runc/libcontainer/cgroups/cgroups.go

55 lines
1.5 KiB
Go
Raw Normal View History

2019-01-12 04:58:27 +00:00
// +build linux
package cgroups
import (
"github.com/opencontainers/runc/libcontainer/configs"
)
type Manager interface {
// Applies cgroup configuration to the process with the specified pid
Apply(pid int) error
// Returns the PIDs inside the cgroup set
GetPids() ([]int, error)
// Returns the PIDs inside the cgroup set & all sub-cgroups
GetAllPids() ([]int, error)
// Returns statistics for the cgroup set
GetStats() (*Stats, error)
// Toggles the freezer cgroup according with specified state
Freeze(state configs.FreezerState) error
// Destroys the cgroup set
Destroy() error
2020-08-10 17:43:49 +00:00
// Path returns a cgroup path to the specified controller/subsystem.
// For cgroupv2, the argument is unused and can be empty.
Path(string) string
2019-01-12 04:58:27 +00:00
// Sets the cgroup as configured.
Set(container *configs.Config) error
2020-08-10 17:43:49 +00:00
// GetPaths returns cgroup path(s) to save in a state file in order to restore later.
//
// For cgroup v1, a key is cgroup subsystem name, and the value is the path
// to the cgroup for this subsystem.
//
// For cgroup v2 unified hierarchy, a key is "", and the value is the unified path.
GetPaths() map[string]string
2019-01-12 04:58:27 +00:00
2020-08-10 17:43:49 +00:00
// GetCgroups returns the cgroup data as configured.
GetCgroups() (*configs.Cgroup, error)
2019-01-12 04:58:27 +00:00
2020-08-10 17:43:49 +00:00
// GetFreezerState retrieves the current FreezerState of the cgroup.
GetFreezerState() (configs.FreezerState, error)
2019-01-12 04:58:27 +00:00
2020-08-10 17:43:49 +00:00
// Whether the cgroup path exists or not
Exists() bool
// OOMKillCount reports OOM kill count for the cgroup.
OOMKillCount() (uint64, error)
2019-01-12 04:58:27 +00:00
}