Skip to content
Snippets Groups Projects
Commit 8df2f5b4 authored by ale's avatar ale
Browse files

Try to handle cgroups v2 unified hierarchy

By simply fixing the cgroup path.
parent d8392fba
No related branches found
No related tags found
No related merge requests found
......@@ -309,8 +309,7 @@ func getCgroupsForPid(pid int) (map[string]string, error) {
scanner := bufio.NewScanner(file)
for scanner.Scan() {
line := strings.SplitN(scanner.Text(), ":", 3)
// line[1] == "" excludes the cgroupv2 unified hierarchy entry.
if len(line) != 3 || line[1] == "" {
if len(line) != 3 {
continue
}
......@@ -325,6 +324,9 @@ func getCgroupsForPid(pid int) (map[string]string, error) {
}
func constructCgroupPath(cgroupName string, cgroupPath string) string {
if cgroupName == "" {
cgroupName = "unified"
}
return path.Join(SYSFS, strings.TrimPrefix(cgroupName, "name="), cgroupPath, PROCS)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment