cgroups/utils.go
func FindCgroupMountpoint(subsystem string) (string, error) {
	f, err := os.Open("/proc/self/mountinfo")
	if err != nil {
		return "", err
	}
	scanner := bufio.NewScanner(f)
	for scanner.Scan() {
		txt := scanner.Text()
		fields := strings.Split(txt, " ")
		for _, opt := range strings.Split(fields[len(fields)-1], ",") {
			if opt == subsystem {
				return fields[4], nil
			}
		}
	}
	if err := scanner.Err(); err != nil {
		return "", err
	}

	return "", NewNotFoundError(subsystem)
}
func FindCgroupMountpoint(subsystem string) (string, error) {
	f, err := os.Open("/proc/self/mountinfo")
	if err != nil {
		return "", err
	}
	scanner := bufio.NewScanner(f)
	for scanner.Scan() {
		txt := scanner.Text()
		fields := strings.Split(txt, " ")
		for _, opt := range strings.Split(fields[len(fields)-1], ",") {
			if opt == subsystem {
				return fields[4], nil
			}
		}
	}
	if err := scanner.Err(); err != nil {
		return "", err
	}

	return "", NewNotFoundError(subsystem)
}
func FindCgroupMountpoint ( subsystem string ) ( string , error ) { f , err := os . Open ( " " ) if err != nil { return " " , err } scanner := bufio . NewScanner ( f ) for scanner . Scan ( ) { txt := scanner . Text ( ) fields := strings . Split ( txt , " " ) for _ , opt := range strings . Split ( fields [ len ( fields ) - 1 ] , " " ) { if opt == subsystem { return fields [ 4 ] , nil } } } if err := scanner . Err ( ) ; err != nil { return " " , err } return " " , NewNotFoundError ( subsystem ) }
// https://www.kernel.org/doc/Documentation/cgroups/cgroups.txt
https : // www . kernel . org / doc / Documentation / cgroups / cgroups . txt