Documentation
¶
Index ¶
- Constants
- Variables
- func GetProcessControllerPath(pid int, controller string) (string, error)
- func GetProcs(name, controller string) ([]int, error)
- func GetSubSysMountPoint(controller string) string
- func GetSubSysMountPoints(controller string) []string
- func GetTasks(name, controller string) ([]int, error)
- func Init() error
- type Cgroup
- func (cg *Cgroup) AddController(name string) *Controller
- func (cg *Cgroup) AllExist() bool
- func (cg *Cgroup) AttachCurrentProcess() error
- func (cg *Cgroup) AttachCurrentTask() error
- func (cg *Cgroup) AttachProcess(pid int) error
- func (cg *Cgroup) AttachTask(tid int) error
- func (cg *Cgroup) Create(ignoreOwnership bool) (err error)
- func (cg *Cgroup) Delete(flags DeleteFlags) (err error)
- func (cg *Cgroup) GetChildren(controller string) ([]string, error)
- func (cg *Cgroup) GetController(name string) *Controller
- func (cg *Cgroup) GetProcs(controller string) ([]int, error)
- func (cg *Cgroup) GetTasks(controller string) ([]int, error)
- func (cg *Cgroup) GetUidGid() (int, int, int, int)
- func (cg *Cgroup) Name() string
- func (cg *Cgroup) NewChildGroup(name string) *Cgroup
- func (cg *Cgroup) NewChildrenGroups(controller string) ([]*Cgroup, error)
- func (cg *Cgroup) SetPermissions(controlDirPerm, controlFilePerm, tasksFilePerm os.FileMode)
- func (cg *Cgroup) SetUidGid(tasksUid, tasksGid, controlUid, controlGid int)
- type Controller
- func (c *Controller) Cgroup() *Cgroup
- func (c *Controller) Exists() bool
- func (c *Controller) GetStats(fields []string, args ...*uint64) (int, error)
- func (c *Controller) GetStatsAll() (map[string]uint64, error)
- func (c *Controller) GetValueBool(name string) (bool, error)
- func (c *Controller) GetValueInt64(name string) (int64, error)
- func (c *Controller) GetValueString(name string) (string, error)
- func (c *Controller) GetValueUint64(name string) (uint64, error)
- func (c *Controller) Name() string
- func (c *Controller) SetValueBool(name string, value bool) error
- func (c *Controller) SetValueInt64(name string, value int64) error
- func (c *Controller) SetValueString(name, value string) error
- func (c *Controller) SetValueUint64(name string, value uint64) error
- type ControllerInfo
- type DeleteFlags
- type MountEntry
- type MountTableItem
Constants ¶
View Source
const ( Blkio = "blkio" Cpu = "cpu" Cpuacct = "cpuacct" Cpuset = "cpuset" Devices = "devices" Freezer = "freezer" Memory = "memory" NetCLS = "net_cls" NetPrio = "net_prio" PerfEvent = "perf_event" Pids = "pids" )
View Source
const ( DeleteFlagIgnoreMigration = 1 << iota DeleteFlagRecursive DeleteFlagEmptyOnly )
Variables ¶
View Source
var ErrCgroupNotMounted = errors.New("cgroup is not mounted")
View Source
var ErrInvalid = errors.New("invalid operation")
View Source
var ErrNonEmpty = errors.New("group is not empty")
View Source
var ErrSubSysNotMounted = errors.New("cgroup one of the needed subsystems is not mounted")
Functions ¶
func GetSubSysMountPoint ¶
func GetSubSysMountPoints ¶
Types ¶
type Cgroup ¶
type Cgroup struct {
// contains filtered or unexported fields
}
func (*Cgroup) AddController ¶
func (cg *Cgroup) AddController(name string) *Controller
func (*Cgroup) AttachCurrentProcess ¶
func (*Cgroup) AttachCurrentTask ¶
func (*Cgroup) AttachProcess ¶
func (*Cgroup) AttachTask ¶
func (*Cgroup) Delete ¶
func (cg *Cgroup) Delete(flags DeleteFlags) (err error)
func (*Cgroup) GetController ¶
func (cg *Cgroup) GetController(name string) *Controller
func (*Cgroup) NewChildGroup ¶
func (*Cgroup) NewChildrenGroups ¶
func (*Cgroup) SetPermissions ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func (*Controller) Cgroup ¶
func (c *Controller) Cgroup() *Cgroup
func (*Controller) Exists ¶
func (c *Controller) Exists() bool
func (*Controller) GetStats ¶
func (c *Controller) GetStats(fields []string, args ...*uint64) (int, error)
func (*Controller) GetStatsAll ¶
func (c *Controller) GetStatsAll() (map[string]uint64, error)
func (*Controller) GetValueBool ¶
func (c *Controller) GetValueBool(name string) (bool, error)
func (*Controller) GetValueInt64 ¶
func (c *Controller) GetValueInt64(name string) (int64, error)
func (*Controller) GetValueString ¶
func (c *Controller) GetValueString(name string) (string, error)
func (*Controller) GetValueUint64 ¶
func (c *Controller) GetValueUint64(name string) (uint64, error)
func (*Controller) Name ¶
func (c *Controller) Name() string
func (*Controller) SetValueBool ¶
func (c *Controller) SetValueBool(name string, value bool) error
func (*Controller) SetValueInt64 ¶
func (c *Controller) SetValueInt64(name string, value int64) error
func (*Controller) SetValueString ¶
func (c *Controller) SetValueString(name, value string) error
func (*Controller) SetValueUint64 ¶
func (c *Controller) SetValueUint64(name string, value uint64) error
type ControllerInfo ¶
type ControllerInfo struct {
// contains filtered or unexported fields
}
func GetAllControllers ¶
func GetAllControllers() ([]*ControllerInfo, error)
GetAllControllers list all controllers, including those which are not mounted.
func (*ControllerInfo) Enabled ¶
func (cd *ControllerInfo) Enabled() bool
func (*ControllerInfo) Hierarchy ¶
func (cd *ControllerInfo) Hierarchy() int
Hierarchy is the identification of the controller. Controllers with the same hierarchy ID are mounted together as one hierarchy. Controllers with ID 0 are not currently mounted anywhere.
func (*ControllerInfo) Name ¶
func (cd *ControllerInfo) Name() string
func (*ControllerInfo) NumCgroups ¶
func (cd *ControllerInfo) NumCgroups() int
type DeleteFlags ¶
type DeleteFlags uint
type MountEntry ¶
type MountEntry struct {
// contains filtered or unexported fields
}
type MountTableItem ¶
type MountTableItem struct {
// contains filtered or unexported fields
}
func GetControllers ¶
func GetControllers() []*MountTableItem
GetControllers list mounted controllers.
func (*MountTableItem) MountPoints ¶
func (item *MountTableItem) MountPoints() []string
func (*MountTableItem) Name ¶
func (item *MountTableItem) Name() string
Click to show internal directories.
Click to hide internal directories.