parseCgroups reads each line of the /proc/[pid]/cgroup file.
(data []byte)
| 71 | |
| 72 | // parseCgroups reads each line of the /proc/[pid]/cgroup file. |
| 73 | func parseCgroups(data []byte) ([]Cgroup, error) { |
| 74 | var cgroups []Cgroup |
| 75 | scanner := bufio.NewScanner(bytes.NewReader(data)) |
| 76 | for scanner.Scan() { |
| 77 | mountString := scanner.Text() |
| 78 | parsedMounts, err := parseCgroupString(mountString) |
| 79 | if err != nil { |
| 80 | return nil, err |
| 81 | } |
| 82 | cgroups = append(cgroups, *parsedMounts) |
| 83 | } |
| 84 | |
| 85 | err := scanner.Err() |
| 86 | return cgroups, err |
| 87 | } |
| 88 | |
| 89 | // Cgroups reads from /proc/<pid>/cgroups and returns a []*Cgroup struct locating this PID in each process |
| 90 | // control hierarchy running on this system. On every system (v1 and v2), all hierarchies contain all processes, |
no test coverage detected
searching dependent graphs…