MCPcopy Index your code
hub / github.com/google/cadvisor / processMaxOpenFileLimitLine

Function processMaxOpenFileLimitLine

lib/container/libcontainer/handler.go:237–259  ·  view source on GitHub ↗

Any caller of processMaxOpenFileLimitLine must ensure that the name prefix is already removed from the limit line. with the "Max open files" prefix.

(name, line string)

Source from the content-addressed store, hash-verified

235// Any caller of processMaxOpenFileLimitLine must ensure that the name prefix is already removed from the limit line.
236// with the "Max open files" prefix.
237func processMaxOpenFileLimitLine(name, line string) (info.UlimitSpec, error) {
238 // Remove any leading whitespace
239 line = strings.TrimSpace(line)
240 // Split on whitespace
241 fields := strings.Fields(line)
242 if len(fields) != 3 {
243 return info.UlimitSpec{}, fmt.Errorf("unable to parse max open files line: %s", line)
244 }
245 // The first field is the soft limit, the second is the hard limit
246 soft, err := parseUlimit(fields[0])
247 if err != nil {
248 return info.UlimitSpec{}, err
249 }
250 hard, err := parseUlimit(fields[1])
251 if err != nil {
252 return info.UlimitSpec{}, err
253 }
254 return info.UlimitSpec{
255 Name: name,
256 SoftLimit: soft,
257 HardLimit: hard,
258 }, nil
259}
260
261func processRootProcUlimits(rootFs string, rootPid int) []info.UlimitSpec {
262 filePath := path.Join(rootFs, "/proc", strconv.Itoa(rootPid), "limits")

Callers 2

processLimitsFileFunction · 0.85

Calls 2

parseUlimitFunction · 0.85
ErrorfMethod · 0.80

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…