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

Function PidPath

cgroup1/paths.go:50–57  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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
50func 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
60var ErrControllerNotActive = errors.New("controller is not supported")

Callers 1

TestPidPathFunction · 0.85

Calls 3

ParseCgroupFileFunction · 0.85
errorPathFunction · 0.85
existingPathFunction · 0.85

Tested by 1

TestPidPathFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…