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

Function parseUint

cgroup1/utils.go:157–173  ·  view source on GitHub ↗
(s string, base, bitSize int)

Source from the content-addressed store, hash-verified

155}
156
157func parseUint(s string, base, bitSize int) (uint64, error) {
158 v, err := strconv.ParseUint(s, base, bitSize)
159 if err != nil {
160 intValue, intErr := strconv.ParseInt(s, base, bitSize)
161 // 1. Handle negative values greater than MinInt64 (and)
162 // 2. Handle negative values lesser than MinInt64
163 if intErr == nil && intValue < 0 {
164 return 0, nil
165 } else if intErr != nil &&
166 intErr.(*strconv.NumError).Err == strconv.ErrRange &&
167 intValue < 0 {
168 return 0, nil
169 }
170 return 0, err
171 }
172 return v, nil
173}
174
175func parseKV(raw string) (string, uint64, error) {
176 parts := strings.Fields(raw)

Callers 3

readUintFunction · 0.70
parseKVFunction · 0.70
parseRdmaKVFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…