Documentation ¶
Index ¶
- Variables
- func DetectUID() (int, error)
- func DetectUserDbusSessionBusAddress() (string, error)
- func ExpandSlice(slice string) (string, error)
- func IsRunningSystemd() bool
- func RangeToBits(str string) ([]byte, error)
- type LegacyManager
- func (m *LegacyManager) Apply(pid int) error
- func (m *LegacyManager) Destroy() error
- func (m *LegacyManager) Exists() bool
- func (m *LegacyManager) Freeze(state configs.FreezerState) error
- func (m *LegacyManager) GetAllPids() ([]int, error)
- func (m *LegacyManager) GetCgroups() (*configs.Cgroup, error)
- func (m *LegacyManager) GetFreezerState() (configs.FreezerState, error)
- func (m *LegacyManager) GetPaths() map[string]string
- func (m *LegacyManager) GetPids() ([]int, error)
- func (m *LegacyManager) GetStats() (*cgroups.Stats, error)
- func (m *LegacyManager) OOMKillCount() (uint64, error)
- func (m *LegacyManager) Path(subsys string) string
- func (m *LegacyManager) Set(r *configs.Resources) error
- type UnifiedManager
- func (m *UnifiedManager) Apply(pid int) error
- func (m *UnifiedManager) Destroy() error
- func (m *UnifiedManager) Exists() bool
- func (m *UnifiedManager) Freeze(state configs.FreezerState) error
- func (m *UnifiedManager) GetAllPids() ([]int, error)
- func (m *UnifiedManager) GetCgroups() (*configs.Cgroup, error)
- func (m *UnifiedManager) GetFreezerState() (configs.FreezerState, error)
- func (m *UnifiedManager) GetPaths() map[string]string
- func (m *UnifiedManager) GetPids() ([]int, error)
- func (m *UnifiedManager) GetStats() (*cgroups.Stats, error)
- func (m *UnifiedManager) OOMKillCount() (uint64, error)
- func (m *UnifiedManager) Path(_ string) string
- func (m *UnifiedManager) Set(r *configs.Resources) error
Constants ¶
This section is empty.
Variables ¶
var ( // GenerateDeviceProps is a function to generate systemd device // properties, used by Set methods. Unless // [github.com/opencontainers/runc/libcontainer/cgroups/devices] // package is imported, it is set to nil, so cgroup managers can't // configure devices. GenerateDeviceProps func(r *configs.Resources, sdVer int) ([]systemdDbus.Property, error) )
Functions ¶
func DetectUID ¶ added in v1.0.0
DetectUID detects UID from the OwnerUID field of `busctl --user status` if running in userNS. The value corresponds to sd_bus_creds_get_owner_uid(3) .
Otherwise returns os.Getuid() .
func DetectUserDbusSessionBusAddress ¶ added in v1.0.0
DetectUserDbusSessionBusAddress returns $DBUS_SESSION_BUS_ADDRESS, if set. Otherwise it returns "unix:path=$XDG_RUNTIME_DIR/bus", if $XDG_RUNTIME_DIR/bus exists.
func ExpandSlice ¶ added in v1.0.0
systemd represents slice hierarchy using `-`, so we need to follow suit when generating the path of slice. Essentially, test-a-b.slice becomes /test.slice/test-a.slice/test-a-b.slice.
func IsRunningSystemd ¶ added in v1.0.0
func IsRunningSystemd() bool
NOTE: This function comes from package github.com/coreos/go-systemd/util It was borrowed here to avoid a dependency on cgo.
IsRunningSystemd checks whether the host was booted with systemd as its init system. This functions similarly to systemd's `sd_booted(3)`: internally, it checks whether /run/systemd/system/ exists and is a directory. http://www.freedesktop.org/software/systemd/man/sd_booted.html
func RangeToBits ¶ added in v1.0.0
RangeToBits converts a text representation of a CPU mask (as written to or read from cgroups' cpuset.* files, e.g. "1,3-5") to a slice of bytes with the corresponding bits set (as consumed by systemd over dbus as AllowedCPUs/AllowedMemoryNodes unit property value).
Types ¶
type LegacyManager ¶ added in v1.2.0
type LegacyManager struct {
// contains filtered or unexported fields
}
func NewLegacyManager ¶ added in v1.0.0
func (*LegacyManager) Apply ¶ added in v1.2.0
func (m *LegacyManager) Apply(pid int) error
func (*LegacyManager) Destroy ¶ added in v1.2.0
func (m *LegacyManager) Destroy() error
func (*LegacyManager) Exists ¶ added in v1.2.0
func (m *LegacyManager) Exists() bool
func (*LegacyManager) Freeze ¶ added in v1.2.0
func (m *LegacyManager) Freeze(state configs.FreezerState) error
func (*LegacyManager) GetAllPids ¶ added in v1.2.0
func (m *LegacyManager) GetAllPids() ([]int, error)
func (*LegacyManager) GetCgroups ¶ added in v1.2.0
func (m *LegacyManager) GetCgroups() (*configs.Cgroup, error)
func (*LegacyManager) GetFreezerState ¶ added in v1.2.0
func (m *LegacyManager) GetFreezerState() (configs.FreezerState, error)
func (*LegacyManager) GetPaths ¶ added in v1.2.0
func (m *LegacyManager) GetPaths() map[string]string
func (*LegacyManager) GetPids ¶ added in v1.2.0
func (m *LegacyManager) GetPids() ([]int, error)
func (*LegacyManager) GetStats ¶ added in v1.2.0
func (m *LegacyManager) GetStats() (*cgroups.Stats, error)
func (*LegacyManager) OOMKillCount ¶ added in v1.2.0
func (m *LegacyManager) OOMKillCount() (uint64, error)
func (*LegacyManager) Path ¶ added in v1.2.0
func (m *LegacyManager) Path(subsys string) string
type UnifiedManager ¶ added in v1.2.0
type UnifiedManager struct {
// contains filtered or unexported fields
}
func NewUnifiedManager ¶ added in v1.0.0
func NewUnifiedManager(config *configs.Cgroup, path string) (*UnifiedManager, error)
func (*UnifiedManager) Apply ¶ added in v1.2.0
func (m *UnifiedManager) Apply(pid int) error
func (*UnifiedManager) Destroy ¶ added in v1.2.0
func (m *UnifiedManager) Destroy() error
func (*UnifiedManager) Exists ¶ added in v1.2.0
func (m *UnifiedManager) Exists() bool
func (*UnifiedManager) Freeze ¶ added in v1.2.0
func (m *UnifiedManager) Freeze(state configs.FreezerState) error
func (*UnifiedManager) GetAllPids ¶ added in v1.2.0
func (m *UnifiedManager) GetAllPids() ([]int, error)
func (*UnifiedManager) GetCgroups ¶ added in v1.2.0
func (m *UnifiedManager) GetCgroups() (*configs.Cgroup, error)
func (*UnifiedManager) GetFreezerState ¶ added in v1.2.0
func (m *UnifiedManager) GetFreezerState() (configs.FreezerState, error)
func (*UnifiedManager) GetPaths ¶ added in v1.2.0
func (m *UnifiedManager) GetPaths() map[string]string
func (*UnifiedManager) GetPids ¶ added in v1.2.0
func (m *UnifiedManager) GetPids() ([]int, error)
func (*UnifiedManager) GetStats ¶ added in v1.2.0
func (m *UnifiedManager) GetStats() (*cgroups.Stats, error)
func (*UnifiedManager) OOMKillCount ¶ added in v1.2.0
func (m *UnifiedManager) OOMKillCount() (uint64, error)
func (*UnifiedManager) Path ¶ added in v1.2.0
func (m *UnifiedManager) Path(_ string) string