DeleteByPathConn deletes the specified cgroup path using the specified dbus connection if needed.
(path string, conn *systemdDbus.Conn)
| 535 | // DeleteByPathConn deletes the specified cgroup path using the specified |
| 536 | // dbus connection if needed. |
| 537 | func (c *CgroupControl) DeleteByPathConn(path string, conn *systemdDbus.Conn) error { |
| 538 | if c.systemd { |
| 539 | return systemdDestroyConn(path, conn) |
| 540 | } |
| 541 | if c.cgroup2 { |
| 542 | return rmDirRecursively(filepath.Join(cgroupRoot, c.path)) |
| 543 | } |
| 544 | var lastError error |
| 545 | for _, h := range handlers { |
| 546 | if err := h.Destroy(c); err != nil { |
| 547 | lastError = err |
| 548 | } |
| 549 | } |
| 550 | |
| 551 | for _, ctr := range c.additionalControllers { |
| 552 | if ctr.symlink { |
| 553 | continue |
| 554 | } |
| 555 | p := c.getCgroupv1Path(ctr.name) |
| 556 | if err := rmDirRecursively(p); err != nil { |
| 557 | lastError = errors.Wrapf(err, "remove %s", p) |
| 558 | } |
| 559 | } |
| 560 | return lastError |
| 561 | } |
| 562 | |
| 563 | // DeleteByPath deletes the specified cgroup path |
| 564 | func (c *CgroupControl) DeleteByPath(path string) error { |
no test coverage detected