MCPcopy Create free account
hub / github.com/containerd/cgroups / Cgroup

Interface Cgroup

cgroup1/control.go:54–99  ·  view source on GitHub ↗

Cgroup handles interactions with the individual groups to perform actions on them as them main interface to this cgroup package

Source from the content-addressed store, hash-verified

52// Cgroup handles interactions with the individual groups to perform
53// actions on them as them main interface to this cgroup package
54type Cgroup interface {
55 // New creates a new cgroup under the calling cgroup
56 New(string, *specs.LinuxResources) (Cgroup, error)
57 // Add adds a process to the cgroup (cgroup.procs). Without additional arguments,
58 // the process is added to all the cgroup subsystems. When giving Add a list of
59 // subsystem names, the process is only added to those subsystems, provided that
60 // they are active in the targeted cgroup.
61 Add(Process, ...Name) error
62 // AddProc adds the process with the given id to the cgroup (cgroup.procs).
63 // Without additional arguments, the process with the given id is added to all
64 // the cgroup subsystems. When giving AddProc a list of subsystem names, the process
65 // id is only added to those subsystems, provided that they are active in the targeted
66 // cgroup.
67 AddProc(uint64, ...Name) error
68 // AddTask adds a process to the cgroup (tasks). Without additional arguments, the
69 // task is added to all the cgroup subsystems. When giving AddTask a list of subsystem
70 // names, the task is only added to those subsystems, provided that they are active in
71 // the targeted cgroup.
72 AddTask(Process, ...Name) error
73 // Delete removes the cgroup as a whole
74 Delete() error
75 // MoveTo moves all the processes under the calling cgroup to the provided one
76 // subsystems are moved one at a time
77 MoveTo(Cgroup) error
78 // Stat returns the stats for all subsystems in the cgroup
79 Stat(...ErrorHandler) (*v1.Metrics, error)
80 // Update updates all the subsystems with the provided resource changes
81 Update(resources *specs.LinuxResources) error
82 // Processes returns all the processes in a select subsystem for the cgroup
83 Processes(Name, bool) ([]Process, error)
84 // Tasks returns all the tasks in a select subsystem for the cgroup
85 Tasks(Name, bool) ([]Task, error)
86 // Freeze freezes or pauses all processes inside the cgroup
87 Freeze() error
88 // Thaw thaw or resumes all processes inside the cgroup
89 Thaw() error
90 // OOMEventFD returns the memory subsystem's event fd for OOM events
91 OOMEventFD() (uintptr, error)
92 // RegisterMemoryEvent returns the memory subsystems event fd for whatever memory event was
93 // registered for. Can alternatively register for the oom event with this method.
94 RegisterMemoryEvent(MemoryEvent) (uintptr, error)
95 // State returns the cgroups current state
96 State() State
97 // Subsystems returns all the subsystems in the cgroup
98 Subsystems() []Subsystem
99}

Callers 43

NewManagerFunction · 0.65
NewChildMethod · 0.65
appendDeviceMethod · 0.65
errors.goFile · 0.65
paths.goFile · 0.65
opts.goFile · 0.65
TestCreateSubCgroupFunction · 0.65
TestAddFunction · 0.65
TestListPidsFunction · 0.65
TestCreateSubCgroupFunction · 0.65

Implementers 1

cgroupcgroup1/cgroup.go

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…