systemd

package
v1.1.12 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 27 Imported by: 362

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectUID added in v1.0.0

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

func DetectUserDbusSessionBusAddress() (string, error)

DetectUserDbusSessionBusAddress returns $DBUS_SESSION_BUS_ADDRESS if set. Otherwise returns "unix:path=$XDG_RUNTIME_DIR/bus" if $XDG_RUNTIME_DIR/bus exists. Otherwise parses the value from `systemctl --user show-environment` .

func ExpandSlice added in v1.0.0

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.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 NewLegacyManager added in v1.0.0

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

func NewUnifiedManager added in v1.0.0

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

func RangeToBits added in v1.0.0

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

This section is empty.

Jump to

Keyboard shortcuts

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