github.com/criyle/go-sandbox@v0.10.3/pkg/cgroup/consts_linux.go (about)

     1  package cgroup
     2  
     3  // Cgroup constants
     4  const (
     5  	// systemd mounted cgroups
     6  	basePath        = "/sys/fs/cgroup"
     7  	cgroupProcs     = "cgroup.procs"
     8  	procCgroupsPath = "/proc/cgroups"
     9  	procSelfCgroup  = "/proc/self/cgroup"
    10  
    11  	cgroupSubtreeControl = "cgroup.subtree_control"
    12  	cgroupControllers    = "cgroup.controllers"
    13  
    14  	filePerm = 0644
    15  	dirPerm  = 0755
    16  
    17  	CPU     = "cpu"
    18  	CPUAcct = "cpuacct"
    19  	CPUSet  = "cpuset"
    20  	Memory  = "memory"
    21  	Pids    = "pids"
    22  )
    23  
    24  // Type defines the version of cgroup
    25  type Type int
    26  
    27  // Type enum for cgroup
    28  const (
    29  	TypeV1 = iota + 1
    30  	TypeV2
    31  )
    32  
    33  func (t Type) String() string {
    34  	switch t {
    35  	case TypeV1:
    36  		return "v1"
    37  	case TypeV2:
    38  		return "v2"
    39  	default:
    40  		return "invalid"
    41  	}
    42  }