Documentation ¶
Index ¶
- Constants
- func CreateV1Cgroups(root string, enabledCgroups map[int][]string, mountContext string) error
- func GetEnabledV1Cgroups() (map[int][]string, error)
- func GetEnabledV2Controllers() ([]string, error)
- func GetOwnV1CgroupPath(controller string) (string, error)
- func GetOwnV2CgroupPath() (string, error)
- func GetV1CgroupPathByPid(pid int, controller string) (string, error)
- func GetV1ControllerDirs(cgroups map[int][]string) []string
- func GetV2CgroupPathByPid(pid int) (string, error)
- func IsCgroupUnified(root string) (bool, error)
- func IsIsolatorSupported(isolator string) (bool, error)
- func IsV1ControllerMounted(c string) bool
- func JoinV1Subcgroup(controller string, subcgroup string) error
- func MaybeAddIsolator(opts []*unit.UnitOption, isolator string, limit *resource.Quantity) ([]*unit.UnitOption, error)
- func RemountV1CgroupsRO(root string, enabledCgroups map[int][]string, subcgroup string, ...) error
Constants ¶
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
CreateV1Cgroups mounts the v1 cgroup controllers hierarchy in /sys/fs/cgroup under root
func GetEnabledV1Cgroups ¶ added in v1.16.0
GetEnabledV1Cgroups returns a map with the enabled cgroup controllers grouped by hierarchy
func GetEnabledV2Controllers ¶ added in v1.16.0
GetEnabledV2Controllers returns a list of enabled cgroup controllers
func GetOwnV1CgroupPath ¶ added in v1.16.0
GetOwnV1CgroupPath returns the cgroup path of this process in controller hierarchy
func GetOwnV2CgroupPath ¶ added in v1.16.0
GetOwnCgroupPath returns the cgroup path of this process
func GetV1CgroupPathByPid ¶ added in v1.16.0
GetV1CgroupPathByPid returns the cgroup path of the process with the given pid and given controller.
func GetV1ControllerDirs ¶ added in v1.16.0
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
GetCgroupPathByPid returns the cgroup path of the process
func IsCgroupUnified ¶ added in v1.16.0
IsCgroupUnified checks if cgroup mounted at /sys/fs/cgroup is the new unified version (cgroup v2)
func IsIsolatorSupported ¶
IsIsolatorSupported returns whether an isolator is supported in the kernel
func IsV1ControllerMounted ¶ added in v1.16.0
IsV1ControllerMounted returns whether a controller is mounted by checking that cgroup.procs is accessible
func JoinV1Subcgroup ¶ added in v1.16.0
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.