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

Function parseUint

cgroup2/utils.go:107–123  ·  view source on GitHub ↗
(s string, base, bitSize int)

Source from the content-addressed store, hash-verified

105}
106
107func parseUint(s string, base, bitSize int) (uint64, error) {
108 v, err := strconv.ParseUint(s, base, bitSize)
109 if err != nil {
110 intValue, intErr := strconv.ParseInt(s, base, bitSize)
111 // 1. Handle negative values greater than MinInt64 (and)
112 // 2. Handle negative values lesser than MinInt64
113 if intErr == nil && intValue < 0 {
114 return 0, nil
115 } else if intErr != nil &&
116 intErr.(*strconv.NumError).Err == strconv.ErrRange &&
117 intValue < 0 {
118 return 0, nil
119 }
120 return 0, err
121 }
122 return v, nil
123}
124
125// parseCgroupFile parses /proc/PID/cgroup file and return string
126func parseCgroupFile(path string) (string, error) {

Callers 3

parseKVFunction · 0.70
getStatFileContentUint64Function · 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…