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

Method add

cgroup1/cgroup.go:224–248  ·  view source on GitHub ↗
(process Process, pType procType, subsystems ...Name)

Source from the content-addressed store, hash-verified

222}
223
224func (c *cgroup) add(process Process, pType procType, subsystems ...Name) error {
225 if process.Pid <= 0 {
226 return ErrInvalidPid
227 }
228 c.mu.Lock()
229 defer c.mu.Unlock()
230 if c.err != nil {
231 return c.err
232 }
233 for _, s := range pathers(c.subsystemsFilter(subsystems...)) {
234 p, err := c.path(s.Name())
235 if err != nil {
236 return err
237 }
238 err = writeCgroupProcs(
239 filepath.Join(s.Path(p), pType),
240 []byte(strconv.Itoa(process.Pid)),
241 defaultFilePerm,
242 )
243 if err != nil {
244 return err
245 }
246 }
247 return nil
248}
249
250// Delete will remove the control group from each of the subsystems registered
251func (c *cgroup) Delete() error {

Callers 3

AddMethod · 0.95
AddProcMethod · 0.95
AddTaskMethod · 0.95

Calls 5

subsystemsFilterMethod · 0.95
pathersFunction · 0.85
writeCgroupProcsFunction · 0.85
NameMethod · 0.65
PathMethod · 0.65

Tested by

no test coverage detected