update github.com/opencontainers/cgroups to v0.0.6

Includes one small fix for a breaking change in a type.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2025-11-06 14:39:04 +01:00
parent 0405a470ef
commit 47ab0f1e94
10 changed files with 64 additions and 32 deletions

View File

@@ -129,12 +129,16 @@ func getPercpuUsageInModes(path string) ([]uint64, []uint64, error) {
defer fd.Close()
scanner := bufio.NewScanner(fd)
scanner.Scan() // skipping header line
scanner.Scan() // Read header line.
const want = "cpu user system"
if hdr := scanner.Text(); !strings.HasPrefix(hdr, want) {
return nil, nil, malformedLine(path, file, hdr)
}
for scanner.Scan() {
// Each line is: cpu user system
fields := strings.SplitN(scanner.Text(), " ", 3)
if len(fields) != 3 {
// Each line is: cpu user system. Keep N at 4 to ignore extra fields.
fields := strings.SplitN(scanner.Text(), " ", 4)
if len(fields) < 3 {
continue
}