4
vendor/github.com/coreos/go-systemd/v22/daemon/watchdog.go
generated
vendored
4
vendor/github.com/coreos/go-systemd/v22/daemon/watchdog.go
generated
vendored
@@ -30,8 +30,8 @@ import (
|
||||
// It returns one of the following:
|
||||
// (0, nil) - watchdog isn't enabled or we aren't the watched PID.
|
||||
// (0, err) - an error happened (e.g. error converting time).
|
||||
// (time, nil) - watchdog is enabled and we can send ping.
|
||||
// time is delay before inactive service will be killed.
|
||||
// (time, nil) - watchdog is enabled and we can send ping. time is delay
|
||||
// before inactive service will be killed.
|
||||
func SdWatchdogEnabled(unsetEnvironment bool) (time.Duration, error) {
|
||||
wusec := os.Getenv("WATCHDOG_USEC")
|
||||
wpid := os.Getenv("WATCHDOG_PID")
|
||||
|
||||
5
vendor/github.com/coreos/go-systemd/v22/dbus/dbus.go
generated
vendored
5
vendor/github.com/coreos/go-systemd/v22/dbus/dbus.go
generated
vendored
@@ -176,6 +176,11 @@ func (c *Conn) Close() {
|
||||
c.sigconn.Close()
|
||||
}
|
||||
|
||||
// Connected returns whether conn is connected
|
||||
func (c *Conn) Connected() bool {
|
||||
return c.sysconn.Connected() && c.sigconn.Connected()
|
||||
}
|
||||
|
||||
// NewConnection establishes a connection to a bus using a caller-supplied function.
|
||||
// This allows connecting to remote buses through a user-supplied mechanism.
|
||||
// The supplied function may be called multiple times, and should return independent connections.
|
||||
|
||||
34
vendor/github.com/coreos/go-systemd/v22/dbus/methods.go
generated
vendored
34
vendor/github.com/coreos/go-systemd/v22/dbus/methods.go
generated
vendored
@@ -417,6 +417,29 @@ func (c *Conn) listUnitsInternal(f storeFunc) ([]UnitStatus, error) {
|
||||
return status, nil
|
||||
}
|
||||
|
||||
// GetUnitByPID returns the unit object path of the unit a process ID
|
||||
// belongs to. It takes a UNIX PID and returns the object path. The PID must
|
||||
// refer to an existing system process
|
||||
func (c *Conn) GetUnitByPID(ctx context.Context, pid uint32) (dbus.ObjectPath, error) {
|
||||
var result dbus.ObjectPath
|
||||
|
||||
err := c.sysobj.CallWithContext(ctx, "org.freedesktop.systemd1.Manager.GetUnitByPID", 0, pid).Store(&result)
|
||||
|
||||
return result, err
|
||||
}
|
||||
|
||||
// GetUnitNameByPID returns the name of the unit a process ID belongs to. It
|
||||
// takes a UNIX PID and returns the object path. The PID must refer to an
|
||||
// existing system process
|
||||
func (c *Conn) GetUnitNameByPID(ctx context.Context, pid uint32) (string, error) {
|
||||
path, err := c.GetUnitByPID(ctx, pid)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return unitName(path), nil
|
||||
}
|
||||
|
||||
// Deprecated: use ListUnitsContext instead.
|
||||
func (c *Conn) ListUnits() ([]UnitStatus, error) {
|
||||
return c.ListUnitsContext(context.Background())
|
||||
@@ -828,3 +851,14 @@ func (c *Conn) listJobsInternal(ctx context.Context) ([]JobStatus, error) {
|
||||
|
||||
return status, nil
|
||||
}
|
||||
|
||||
// Freeze the cgroup associated with the unit.
|
||||
// Note that FreezeUnit and ThawUnit are only supported on systems running with cgroup v2.
|
||||
func (c *Conn) FreezeUnit(ctx context.Context, unit string) error {
|
||||
return c.sysobj.CallWithContext(ctx, "org.freedesktop.systemd1.Manager.FreezeUnit", 0, unit).Store()
|
||||
}
|
||||
|
||||
// Unfreeze the cgroup associated with the unit.
|
||||
func (c *Conn) ThawUnit(ctx context.Context, unit string) error {
|
||||
return c.sysobj.CallWithContext(ctx, "org.freedesktop.systemd1.Manager.ThawUnit", 0, unit).Store()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user