Skip to content

Commit d244b40

Browse files
committed
libct/cgroups: improve ParseCgroupFile docs
In particular, state that for cgroup v2 the result is very different. Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent 5785aab commit d244b40

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

libcontainer/cgroups/utils.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,15 @@ func readProcsFile(file string) ([]int, error) {
373373
return out, nil
374374
}
375375

376-
// ParseCgroupFile parses the given cgroup file, typically from
377-
// /proc/<pid>/cgroup, into a map of subgroups to cgroup names.
376+
// ParseCgroupFile parses the given cgroup file, typically /proc/self/cgroup
377+
// or /proc/<pid>/cgroup, into a map of subsystems to cgroup paths, e.g.
378+
// "cpu": "/user.slice/user-1000.slice"
379+
// "pids": "/user.slice/user-1000.slice"
380+
// etc.
381+
//
382+
// Note that for cgroup v2 unified hierarchy, there are no per-controller
383+
// cgroup paths, so the resulting map will have a single element where the key
384+
// is empty string ("") and the value is the cgroup path the <pid> is in.
378385
func ParseCgroupFile(path string) (map[string]string, error) {
379386
f, err := os.Open(path)
380387
if err != nil {

0 commit comments

Comments
 (0)