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

Function systemdVersionAtoi

cgroup2/manager.go:1062–1078  ·  view source on GitHub ↗
(str string)

Source from the content-addressed store, hash-verified

1060}
1061
1062func systemdVersionAtoi(str string) (int, error) {
1063 // Unconditionally remove the leading prefix ("v).
1064 str = strings.TrimLeft(str, `"v`)
1065 // Match on the first integer we can grab.
1066 for i := range len(str) {
1067 if str[i] < '0' || str[i] > '9' {
1068 // First non-digit: cut the tail.
1069 str = str[:i]
1070 break
1071 }
1072 }
1073 ver, err := strconv.Atoi(str)
1074 if err != nil {
1075 return -1, fmt.Errorf("can't parse version: %w", err)
1076 }
1077 return ver, nil
1078}
1079
1080func startUnit(conn *systemdDbus.Conn, group string, properties []systemdDbus.Property, ignoreExists bool) error {
1081 ctx := context.TODO()

Callers 1

systemdVersionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…