Documentation ¶
Overview ¶
Code in this package is heavily adapted from https://github.com/opencontainers/runc/blob/7362fa2d282feffb9b19911150e01e390a23899d/libcontainer/cgroups/systemd Credit goes to the runc authors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectUID ¶
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 ¶
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` .
Types ¶
type DbusConnManager ¶
type DbusConnManager struct{}
func NewDbusConnManager ¶
func NewDbusConnManager(rootless bool) *DbusConnManager
NewDbusConnManager initializes systemd dbus connection manager.
func (*DbusConnManager) GetConnection ¶
func (d *DbusConnManager) GetConnection() (*systemdDbus.Conn, error)
getConnection lazily initializes and returns systemd dbus connection.
func (*DbusConnManager) RetryOnDisconnect ¶
func (d *DbusConnManager) RetryOnDisconnect(op func(*systemdDbus.Conn) error) error
RetryOnDisconnect calls op, and if the error it returns is about closed dbus connection, the connection is re-established and the op is retried. This helps with the situation when dbus is restarted and we have a stale connection.