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

Method MoveTo

cgroup1/cgroup.go:530–551  ·  view source on GitHub ↗

MoveTo does a recursive move subsystem by subsystem of all the processes inside the group

(destination Cgroup)

Source from the content-addressed store, hash-verified

528// MoveTo does a recursive move subsystem by subsystem of all the processes
529// inside the group
530func (c *cgroup) MoveTo(destination Cgroup) error {
531 c.mu.Lock()
532 defer c.mu.Unlock()
533 if c.err != nil {
534 return c.err
535 }
536 for _, s := range c.subsystems {
537 processes, err := c.processes(s.Name(), true, cgroupProcs)
538 if err != nil {
539 return err
540 }
541 for _, p := range processes {
542 if err := destination.Add(p); err != nil {
543 if strings.Contains(err.Error(), "no such process") {
544 continue
545 }
546 return err
547 }
548 }
549 }
550 return nil
551}
552
553func (c *cgroup) getSubsystem(n Name) Subsystem {
554 for _, s := range c.subsystems {

Callers

nothing calls this directly

Calls 3

processesMethod · 0.95
NameMethod · 0.65
AddMethod · 0.65

Tested by

no test coverage detected