MCPcopy Create free account
hub / github.com/prometheus/procfs / parseCgroups

Function parseCgroups

proc_cgroup.go:73–87  ·  view source on GitHub ↗

parseCgroups reads each line of the /proc/[pid]/cgroup file.

(data []byte)

Source from the content-addressed store, hash-verified

71
72// parseCgroups reads each line of the /proc/[pid]/cgroup file.
73func 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,

Callers 1

CgroupsMethod · 0.85

Calls 2

parseCgroupStringFunction · 0.85
ErrMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…