MoveTo does a recursive move subsystem by subsystem of all the processes inside the group
(destination Cgroup)
| 528 | // MoveTo does a recursive move subsystem by subsystem of all the processes |
| 529 | // inside the group |
| 530 | func (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 | |
| 553 | func (c *cgroup) getSubsystem(n Name) Subsystem { |
| 554 | for _, s := range c.subsystems { |