MCPcopy Create free account
hub / github.com/containers/common / cgroupV1GetAllSubsystems

Function cgroupV1GetAllSubsystems

pkg/cgroups/cgroups.go:197–220  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

195}
196
197func 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
222func getCgroupPathForCurrentProcess() (string, error) {
223 path := fmt.Sprintf("/proc/%d/cgroup", os.Getpid())

Callers 1

getAvailableControllersFunction · 0.85

Calls 1

CloseMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…