(subsystem string)
| 210 | } |
| 211 | |
| 212 | func 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 | |
| 240 | func pathers(subsystems []Subsystem) []pather { |
| 241 | var out []pather |
no outgoing calls
no test coverage detected
searching dependent graphs…