Versions in this module Expand all Collapse all v1 v1.0.0 Sep 22, 2020 Changes in this version + var ErrCgroupDeleted = errors.New("cgroups: cgroup deleted") + var ErrControllerNotActive = errors.New("controller is not supported") + var ErrDevicesRequired = errors.New("devices subsystem is required") + var ErrFreezerNotSupported = errors.New("cgroups: freezer cgroup not supported on this system") + var ErrIgnoreSubsystem = errors.New("skip subsystem") + var ErrInvalidFormat = errors.New("cgroups: parsing file with invalid format failed") + var ErrInvalidPid = errors.New("cgroups: pid must be greater than 0") + var ErrMemoryNotSupported = errors.New("cgroups: memory cgroup not supported on this system") + var ErrMountPointNotExist = errors.New("cgroups: cgroup mountpoint does not exist") + var ErrNoCgroupMountDestination = errors.New("cgroups: cannot find cgroup mount destination") + func AllowAny(_ Subsystem, _ Path, _ error) error + func IgnoreModules(names ...string) func(*memoryController) + func IgnoreNotExist(err error) error + func NewBlkio(root string, options ...func(controller *blkioController)) *blkioController + func NewCpu(root string) *cpuController + func NewCpuacct(root string) *cpuacctController + func NewCpuset(root string) *cpusetController + func NewDevices(root string) *devicesController + func NewFreezer(root string) *freezerController + func NewHugetlb(root string) (*hugetlbController, error) + func NewMemory(root string, options ...func(*memoryController)) *memoryController + func NewNamed(root string, name Name) *namedController + func NewNetCls(root string) *netclsController + func NewNetPrio(root string) *netprioController + func NewPids(root string) *pidsController + func NewRdma(root string) *rdmaController + func OptionalSwap() func(*memoryController) + func ProcRoot(path string) func(controller *blkioController) + func RequireDevices(s Subsystem, _ Path, _ error) error + func RootPath(subsystem Name) (string, error) + type CGMode int + const Hybrid + const Legacy + const Unavailable + const Unified + func Mode() CGMode + type Cgroup interface + Add func(Process) error + AddTask func(Process) error + Delete func() error + Freeze func() error + MoveTo func(Cgroup) error + New func(string, *specs.LinuxResources) (Cgroup, error) + OOMEventFD func() (uintptr, error) + Processes func(Name, bool) ([]Process, error) + RegisterMemoryEvent func(MemoryEvent) (uintptr, error) + Stat func(...ErrorHandler) (*v1.Metrics, error) + State func() State + Subsystems func() []Subsystem + Tasks func(Name, bool) ([]Task, error) + Thaw func() error + Update func(resources *specs.LinuxResources) error + func Load(hierarchy Hierarchy, path Path, opts ...InitOpts) (Cgroup, error) + func New(hierarchy Hierarchy, path Path, resources *specs.LinuxResources, ...) (Cgroup, error) + type ErrorHandler func(err error) error + type EventNotificationMode string + const DefaultMode + const HierarchyMode + const LocalMode + type Hierarchy func() ([]Subsystem, error) + func SingleSubsystem(baseHierarchy Hierarchy, subsystem Name) Hierarchy + type InitCheck func(Subsystem, Path, error) error + type InitConfig struct + InitCheck InitCheck + type InitOpts func(*InitConfig) error + type MemoryEvent interface + Arg func() string + EventFile func() string + func MemoryPressureEvent(pressureLevel MemoryPressureLevel, hierarchy EventNotificationMode) MemoryEvent + func MemoryThresholdEvent(threshold uint64, swap bool) MemoryEvent + func OOMEvent() MemoryEvent + type MemoryPressureLevel string + const CriticalPressure + const LowPressure + const MediumPressure + type Name string + const Blkio + const Cpu + const Cpuacct + const Cpuset + const Devices + const Freezer + const Hugetlb + const Memory + const NetCLS + const NetPrio + const PerfEvent + const Pids + const Rdma + const SystemdDbus + func Subsystems() []Name + type Path func(subsystem Name) (string, error) + func NestedPath(suffix string) Path + func PidPath(pid int) Path + func Slice(slice, name string) Path + func StaticPath(path string) Path + type PerfEventController struct + func NewPerfEvent(root string) *PerfEventController + func (p *PerfEventController) Name() Name + func (p *PerfEventController) Path(path string) string + type Process struct + Path string + Pid int + Subsystem Name + type State string + const Deleted + const Freezing + const Frozen + const Thawed + const Unknown + type Subsystem interface + Name func() Name + func Systemd() ([]Subsystem, error) + func V1() ([]Subsystem, error) + type SystemdController struct + func NewSystemd(root string) (*SystemdController, error) + func (s *SystemdController) Create(path string, _ *specs.LinuxResources) error + func (s *SystemdController) Delete(path string) error + func (s *SystemdController) Name() Name + type Task struct + Path string + Pid int + Subsystem Name