cgroups/utils.go
func GetAllSubsystems() ([]string, error) {
	f, err := os.Open("/proc/cgroups")
	if err != nil {
		return nil, err
	}
	defer f.Close()

	subsystems := []string{}

	s := bufio.NewScanner(f)
	for s.Scan() {
		if err := s.Err(); err != nil {
			return nil, err
		}
		text := s.Text()
		if text[0] != '#' {
			parts := strings.Fields(text)
			if len(parts) >= 4 && parts[3] != "0" {
				subsystems = append(subsystems, parts[0])
			}
		}
	}
	return subsystems, nil
}
func GetAllSubsystems() ([]string, error) {
	f, err := os.Open("/proc/cgroups")
	if err != nil {
		return nil, err
	}
	defer f.Close()

	subsystems := []string{}

	s := bufio.NewScanner(f)
	for s.Scan() {
		if err := s.Err(); err != nil {
			return nil, err
		}
		text := s.Text()
		if text[0] != '#' {
			parts := strings.Fields(text)
			if len(parts) >= 4 && parts[3] != "0" {
				subsystems = append(subsystems, parts[0])
			}
		}
	}
	return subsystems, nil
}
func GetAllSubsystems ( ) ( [ ] string , error ) { f , err := os . Open ( " " ) if err != nil { return nil , err } defer f . Close ( ) subsystems := [ ] string { } s := bufio . NewScanner ( f ) for s . Scan ( ) { if err := s . Err ( ) ; err != nil { return nil , err } text := s . Text ( ) if text [ 0 ] != '#' { parts := strings . Fields ( text ) if len ( parts ) >= 4 && parts [ 3 ] != " " { subsystems = append ( subsystems , parts [ 0 ] ) } } } return subsystems , nil }
// Returns all the cgroup subsystems supported by the kernel
Returns all the cgroup subsystems supported by the kernel