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)
| 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. |
| 237 | func 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 | |
| 261 | func processRootProcUlimits(rootFs string, rootPid int) []info.UlimitSpec { |
| 262 | filePath := path.Join(rootFs, "/proc", strconv.Itoa(rootPid), "limits") |
searching dependent graphs…