MCPcopy
hub / github.com/google/cadvisor / processLimitsFile

Function processLimitsFile

lib/container/libcontainer/handler.go:214–233  ·  view source on GitHub ↗
(fileData string)

Source from the content-addressed store, hash-verified

212}
213
214func processLimitsFile(fileData string) []info.UlimitSpec {
215 const maxOpenFilesLinePrefix = "Max open files"
216
217 limits := strings.Split(fileData, "\n")
218 ulimits := make([]info.UlimitSpec, 0, len(limits))
219 for _, lim := range limits {
220 // Skip any headers/footers
221 if strings.HasPrefix(lim, "Max open files") {
222 // Remove line prefix
223 ulimit, err := processMaxOpenFileLimitLine(
224 "max_open_files",
225 lim[len(maxOpenFilesLinePrefix):],
226 )
227 if err == nil {
228 ulimits = append(ulimits, ulimit)
229 }
230 }
231 }
232 return ulimits
233}
234
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.

Callers 3

processRootProcUlimitsFunction · 0.85
TestParseLimitsFileFunction · 0.85

Calls 1

Tested by 2

TestParseLimitsFileFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…