MCPcopy Create free account
hub / github.com/containerd/cgroups / getCgroupDestination

Function getCgroupDestination

cgroup1/utils.go:212–238  ·  view source on GitHub ↗
(subsystem string)

Source from the content-addressed store, hash-verified

210}
211
212func getCgroupDestination(subsystem string) (string, error) {
213 f, err := os.Open("/proc/self/mountinfo")
214 if err != nil {
215 return "", err
216 }
217 defer f.Close()
218 s := bufio.NewScanner(f)
219 for s.Scan() {
220 fields := strings.Split(s.Text(), " ")
221 if len(fields) < 10 {
222 // broken mountinfo?
223 continue
224 }
225 if fields[len(fields)-3] != "cgroup" {
226 continue
227 }
228 for _, opt := range strings.Split(fields[len(fields)-1], ",") {
229 if opt == subsystem {
230 return fields[3], nil
231 }
232 }
233 }
234 if err := s.Err(); err != nil {
235 return "", err
236 }
237 return "", ErrNoCgroupMountDestination
238}
239
240func pathers(subsystems []Subsystem) []pather {
241 var out []pather

Callers 1

existingPathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…