cgroup

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2016 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The following const comes from
	// #define CGROUP2_SUPER_MAGIC  0x63677270
	// https://github.com/torvalds/linux/blob/v4.6/include/uapi/linux/magic.h#L58
	Cgroup2fsMagicNumber = 0x63677270
)

Variables

This section is empty.

Functions

func CreateV1Cgroups added in v1.16.0

func CreateV1Cgroups(root string, enabledCgroups map[int][]string, mountContext string) error

CreateV1Cgroups mounts the v1 cgroup controllers hierarchy in /sys/fs/cgroup under root

func GetEnabledV1Cgroups added in v1.16.0

func GetEnabledV1Cgroups() (map[int][]string, error)

GetEnabledV1Cgroups returns a map with the enabled cgroup controllers grouped by hierarchy

func GetEnabledV2Controllers added in v1.16.0

func GetEnabledV2Controllers() ([]string, error)

GetEnabledV2Controllers returns a list of enabled cgroup controllers

func GetOwnV1CgroupPath added in v1.16.0

func GetOwnV1CgroupPath(controller string) (string, error)

GetOwnV1CgroupPath returns the cgroup path of this process in controller hierarchy

func GetOwnV2CgroupPath added in v1.16.0

func GetOwnV2CgroupPath() (string, error)

GetOwnCgroupPath returns the cgroup path of this process

func GetV1CgroupPathByPid added in v1.16.0

func GetV1CgroupPathByPid(pid int, controller string) (string, error)

GetV1CgroupPathByPid returns the cgroup path of the process with the given pid and given controller.

func GetV1ControllerDirs added in v1.16.0

func GetV1ControllerDirs(cgroups map[int][]string) []string

GetV1ControllerDirs takes a map with the enabled cgroup controllers grouped by hierarchy and returns the directory names as they should be in /sys/fs/cgroup

func GetV2CgroupPathByPid added in v1.16.0

func GetV2CgroupPathByPid(pid int) (string, error)

GetCgroupPathByPid returns the cgroup path of the process

func IsCgroupUnified added in v1.16.0

func IsCgroupUnified(root string) (bool, error)

IsCgroupUnified checks if cgroup mounted at /sys/fs/cgroup is the new unified version (cgroup v2)

func IsIsolatorSupported

func IsIsolatorSupported(isolator string) (bool, error)

IsIsolatorSupported returns whether an isolator is supported in the kernel

func IsV1ControllerMounted added in v1.16.0

func IsV1ControllerMounted(c string) bool

IsV1ControllerMounted returns whether a controller is mounted by checking that cgroup.procs is accessible

func JoinV1Subcgroup added in v1.16.0

func JoinV1Subcgroup(controller string, subcgroup string) error

JoinV1Subcgroup makes the calling process join the subcgroup hierarchy on a particular controller

func MaybeAddIsolator

func MaybeAddIsolator(opts []*unit.UnitOption, isolator string, limit *resource.Quantity) ([]*unit.UnitOption, error)

MaybeAddIsolator considers the given isolator; if the type is known (i.e. IsIsolatorSupported is true) and the limit is non-nil, the supplied opts will be extended with an appropriate option implementing the desired isolation.

func RemountV1CgroupsRO added in v1.16.0

func RemountV1CgroupsRO(root string, enabledCgroups map[int][]string, subcgroup string, serviceNames []string) error

RemountV1CgroupsRO remounts the v1 cgroup hierarchy under root read-only, leaving the needed knobs in the subcgroup for each app read-write so the systemd inside stage1 can apply isolators to them

Types

This section is empty.

Jump to

Keyboard shortcuts

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