v1MountPoint returns the mount point where the cgroup mountpoints are mounted in a single hierarchy
()
| 47 | // v1MountPoint returns the mount point where the cgroup |
| 48 | // mountpoints are mounted in a single hierarchy |
| 49 | func v1MountPoint() (string, error) { |
| 50 | f, err := os.Open("/proc/self/mountinfo") |
| 51 | if err != nil { |
| 52 | return "", err |
| 53 | } |
| 54 | defer f.Close() |
| 55 | scanner := bufio.NewScanner(f) |
| 56 | for scanner.Scan() { |
| 57 | var ( |
| 58 | text = scanner.Text() |
| 59 | fields = strings.Split(text, " ") |
| 60 | numFields = len(fields) |
| 61 | ) |
| 62 | if numFields < 10 { |
| 63 | return "", fmt.Errorf("mountinfo: bad entry %q", text) |
| 64 | } |
| 65 | if fields[numFields-3] == "cgroup" { |
| 66 | return filepath.Dir(fields[4]), nil |
| 67 | } |
| 68 | } |
| 69 | if err := scanner.Err(); err != nil { |
| 70 | return "", err |
| 71 | } |
| 72 | return "", ErrMountPointNotExist |
| 73 | } |
no outgoing calls
searching dependent graphs…