(path string)
| 640 | } |
| 641 | |
| 642 | func readCgroup2MapPath(path string) (map[string][]string, error) { |
| 643 | ret := map[string][]string{} |
| 644 | f, err := os.Open(path) |
| 645 | if err != nil { |
| 646 | if os.IsNotExist(err) { |
| 647 | return ret, nil |
| 648 | } |
| 649 | return nil, errors.Wrapf(err, "open file %s", path) |
| 650 | } |
| 651 | defer f.Close() |
| 652 | scanner := bufio.NewScanner(f) |
| 653 | for scanner.Scan() { |
| 654 | line := scanner.Text() |
| 655 | parts := strings.Fields(line) |
| 656 | if len(parts) < 2 { |
| 657 | continue |
| 658 | } |
| 659 | ret[parts[0]] = parts[1:] |
| 660 | } |
| 661 | if err := scanner.Err(); err != nil { |
| 662 | return nil, errors.Wrapf(err, "parsing file %s", path) |
| 663 | } |
| 664 | return ret, nil |
| 665 | } |
| 666 | |
| 667 | func readCgroup2MapFile(ctr *CgroupControl, name string) (map[string][]string, error) { |
| 668 | p := filepath.Join(cgroupRoot, ctr.path, name) |
no test coverage detected
searching dependent graphs…