9 // Return the current process's cgroup for the given subsystem.
10 func findCgroup(subsystem string) string {
11 subsys := []byte(subsystem)
12 cgroups, err := ioutil.ReadFile("/proc/self/cgroup")
16 for _, line := range bytes.Split(cgroups, []byte("\n")) {
17 toks := bytes.SplitN(line, []byte(":"), 4)
21 for _, s := range bytes.Split(toks[1], []byte(",")) {
22 if bytes.Compare(s, subsys) == 0 {
23 return string(toks[2])
27 log.Fatalf("subsystem %q not found in /proc/self/cgroup", subsystem)