cgroups

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//DevicesSubsystem device subsystem
	DevicesSubsystem = Subsystem("devices")
	//CPUSetSubsystem cpu subsystem
	CPUSetSubsystem = Subsystem("cpuset")
	//MemorySubsystem memory subsystem
	MemorySubsystem = Subsystem("memory")

	//CGroupBase base mount point
	CGroupBase = "/sys/fs/cgroup"
)

Variables

View Source
var (

	//ErrDoesNotExist does not exist error
	ErrDoesNotExist = fmt.Errorf("cgroup does not exist")
	//ErrInvalidType invalid cgroup type
	ErrInvalidType = fmt.Errorf("cgroup of invalid type")
)

Functions

func Exists added in v1.4.0

func Exists(subsystem Subsystem, name string) bool

Exists Check if a cgroup exists

func GetGroups added in v1.4.0

func GetGroups() (map[Subsystem][]string, error)

GetGroups gets all the available groups names grouped by susbsytem

func Init

func Init() (err error)

Init Initialized the cgroup subsystem

func Remove added in v1.4.0

func Remove(subsystem Subsystem, name string) error

Remove removes a cgroup

Types

type CPUSetGroup added in v1.4.0

type CPUSetGroup interface {
	Group
	Cpus(sepc string) error
	Mems(sepc string) error
	GetCpus() (string, error)
	GetMems() (string, error)
}

type DevicesGroup

type DevicesGroup interface {
	Group
	Deny(spec string) error
	Allow(spec string) error
	List() ([]string, error)
}

type Group

type Group interface {
	Name() string
	Subsystem() Subsystem
	Task(pid int) error
	Tasks() ([]int, error)
	Root() Group
	Reset()
}

Group generic cgroup interface

func Get added in v1.4.0

func Get(subsystem Subsystem, name string) (Group, error)

Get group only if it exists

func GetGroup

func GetGroup(subsystem Subsystem, name string) (Group, error)

GetGroup creaes a group if it does not exist

type GroupArg added in v1.4.0

type GroupArg struct {
	Subsystem Subsystem `json:"subsystem"`
	Name      string    `json:"name"`
}

type MemoryGroup added in v1.4.0

type MemoryGroup interface {
	Group
	Limits() (int, int, error)
	Limit(mem, swap int) error
}

type Subsystem added in v1.4.0

type Subsystem string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL