systemd

package
v1.10.3 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 24 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GenerateDeviceProps func(r *configs.Resources, sdVer int) ([]systemdDbus.Property, error)
)

Functions

func DetectUID added in v1.10.1

func DetectUID() (int, error)

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.10.1

func DetectUserDbusSessionBusAddress() (string, error)

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.10.1

func ExpandSlice(slice string) (string, error)

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.10.1

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.10.1

func RangeToBits(str string) ([]byte, error)

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.10.1

type LegacyManager struct {
	// contains filtered or unexported fields
}

func NewLegacyManager added in v1.10.1

func NewLegacyManager(cg *configs.Cgroup, paths map[string]string) (*LegacyManager, error)

func (*LegacyManager) Apply added in v1.10.1

func (m *LegacyManager) Apply(pid int) error

func (*LegacyManager) Destroy added in v1.10.1

func (m *LegacyManager) Destroy() error

func (*LegacyManager) Exists added in v1.10.1

func (m *LegacyManager) Exists() bool

func (*LegacyManager) Freeze added in v1.10.1

func (m *LegacyManager) Freeze(state configs.FreezerState) error

func (*LegacyManager) GetAllPids added in v1.10.1

func (m *LegacyManager) GetAllPids() ([]int, error)

func (*LegacyManager) GetCgroups added in v1.10.1

func (m *LegacyManager) GetCgroups() (*configs.Cgroup, error)

func (*LegacyManager) GetFreezerState added in v1.10.1

func (m *LegacyManager) GetFreezerState() (configs.FreezerState, error)

func (*LegacyManager) GetPaths added in v1.10.1

func (m *LegacyManager) GetPaths() map[string]string

func (*LegacyManager) GetPids added in v1.10.1

func (m *LegacyManager) GetPids() ([]int, error)

func (*LegacyManager) GetStats added in v1.10.1

func (m *LegacyManager) GetStats() (*cgroups.Stats, error)

func (*LegacyManager) OOMKillCount added in v1.10.1

func (m *LegacyManager) OOMKillCount() (uint64, error)

func (*LegacyManager) Path added in v1.10.1

func (m *LegacyManager) Path(subsys string) string

func (*LegacyManager) Set added in v1.10.1

func (m *LegacyManager) Set(r *configs.Resources) error

type UnifiedManager added in v1.10.1

type UnifiedManager struct {
	// contains filtered or unexported fields
}

func NewUnifiedManager added in v1.10.1

func NewUnifiedManager(config *configs.Cgroup, path string) (*UnifiedManager, error)

func (*UnifiedManager) Apply added in v1.10.1

func (m *UnifiedManager) Apply(pid int) error

func (*UnifiedManager) Destroy added in v1.10.1

func (m *UnifiedManager) Destroy() error

func (*UnifiedManager) Exists added in v1.10.1

func (m *UnifiedManager) Exists() bool

func (*UnifiedManager) Freeze added in v1.10.1

func (m *UnifiedManager) Freeze(state configs.FreezerState) error

func (*UnifiedManager) GetAllPids added in v1.10.1

func (m *UnifiedManager) GetAllPids() ([]int, error)

func (*UnifiedManager) GetCgroups added in v1.10.1

func (m *UnifiedManager) GetCgroups() (*configs.Cgroup, error)

func (*UnifiedManager) GetFreezerState added in v1.10.1

func (m *UnifiedManager) GetFreezerState() (configs.FreezerState, error)

func (*UnifiedManager) GetPaths added in v1.10.1

func (m *UnifiedManager) GetPaths() map[string]string

func (*UnifiedManager) GetPids added in v1.10.1

func (m *UnifiedManager) GetPids() ([]int, error)

func (*UnifiedManager) GetStats added in v1.10.1

func (m *UnifiedManager) GetStats() (*cgroups.Stats, error)

func (*UnifiedManager) OOMKillCount added in v1.10.1

func (m *UnifiedManager) OOMKillCount() (uint64, error)

func (*UnifiedManager) Path added in v1.10.1

func (m *UnifiedManager) Path(_ string) string

func (*UnifiedManager) Set added in v1.10.1

Jump to

Keyboard shortcuts

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