PidPath will return the correct cgroup paths for an existing process running inside a cgroup This is commonly used for the Load function to restore an existing container
(pid int)
| 48 | // PidPath will return the correct cgroup paths for an existing process running inside a cgroup |
| 49 | // This is commonly used for the Load function to restore an existing container |
| 50 | func PidPath(pid int) Path { |
| 51 | p := fmt.Sprintf("/proc/%d/cgroup", pid) |
| 52 | paths, err := ParseCgroupFile(p) |
| 53 | if err != nil { |
| 54 | return errorPath(fmt.Errorf("parse cgroup file %s: %w", p, err)) |
| 55 | } |
| 56 | return existingPath(paths, "") |
| 57 | } |
| 58 | |
| 59 | // ErrControllerNotActive is returned when a controller is not supported or enabled |
| 60 | var ErrControllerNotActive = errors.New("controller is not supported") |
searching dependent graphs…