(fileData string)
| 212 | } |
| 213 | |
| 214 | func 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. |
searching dependent graphs…