()
| 195 | } |
| 196 | |
| 197 | func cgroupV1GetAllSubsystems() ([]string, error) { |
| 198 | f, err := os.Open("/proc/cgroups") |
| 199 | if err != nil { |
| 200 | return nil, err |
| 201 | } |
| 202 | defer f.Close() |
| 203 | |
| 204 | subsystems := []string{} |
| 205 | |
| 206 | s := bufio.NewScanner(f) |
| 207 | for s.Scan() { |
| 208 | text := s.Text() |
| 209 | if text[0] != '#' { |
| 210 | parts := strings.Fields(text) |
| 211 | if len(parts) >= 4 && parts[3] != "0" { |
| 212 | subsystems = append(subsystems, parts[0]) |
| 213 | } |
| 214 | } |
| 215 | } |
| 216 | if err := s.Err(); err != nil { |
| 217 | return nil, err |
| 218 | } |
| 219 | return subsystems, nil |
| 220 | } |
| 221 | |
| 222 | func getCgroupPathForCurrentProcess() (string, error) { |
| 223 | path := fmt.Sprintf("/proc/%d/cgroup", os.Getpid()) |
no test coverage detected
searching dependent graphs…