MCPcopy Create free account
hub / github.com/containerd/cgroups / systemdVersion

Function systemdVersion

cgroup2/manager.go:1046–1060  ·  view source on GitHub ↗

Adapted from https://github.com/opencontainers/cgroups/blob/9657f5a18b8d60a0f39fbb34d0cb7771e28e6278/systemd/common.go#L245-L281

(conn *systemdDbus.Conn)

Source from the content-addressed store, hash-verified

1044
1045// Adapted from https://github.com/opencontainers/cgroups/blob/9657f5a18b8d60a0f39fbb34d0cb7771e28e6278/systemd/common.go#L245-L281
1046func systemdVersion(conn *systemdDbus.Conn) int {
1047 versionOnce.Do(func() {
1048 version = -1
1049 verStr, err := conn.GetManagerProperty("Version")
1050 if err == nil {
1051 version, err = systemdVersionAtoi(verStr)
1052 }
1053
1054 if err != nil {
1055 log.G(context.TODO()).WithError(err).Error("Unable to get systemd version")
1056 }
1057 })
1058
1059 return version
1060}
1061
1062func systemdVersionAtoi(str string) (int, error) {
1063 // Unconditionally remove the leading prefix ("v).

Callers 2

requireSystemdVersionFunction · 0.85
NewSystemdFunction · 0.85

Calls 1

systemdVersionAtoiFunction · 0.85

Tested by 1

requireSystemdVersionFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…