Skip to content

Commit

Permalink
Add comment about format of /proc/cgroups
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewkroh committed Feb 28, 2017
1 parent 4b15bd3 commit 4c790f7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cgroup/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,25 @@ func SupportedSubsystems(rootfsMountpoint string) (map[string]struct{}, error) {
continue
}

// Parse the cgroup subsystems.
// Format: subsys_name hierarchy num_cgroups enabled
// Example: cpuset 4 1 1
fields := strings.Fields(line)
if len(fields) == 0 {
continue
}

subsystem := fields[0]
if len(fields) >= 4 {
// Check the enabled flag.
if len(fields) > 3 {
enabled := fields[3]
if enabled == "0" {
// Ignore cgroup subsystems that are disabled (via the
// cgroup_disable kernel command-line boot parameter).
continue
}
}

subsystem := fields[0]
subsystemSet[subsystem] = struct{}{}
}

Expand Down

0 comments on commit 4c790f7

Please sign in to comment.