Skip to content

Commit

Permalink
Handle threaded cgroup types
Browse files Browse the repository at this point in the history
  • Loading branch information
Bacto committed Feb 5, 2024
1 parent 0c5a735 commit fa31d79
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion libcontainer/cgroups/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import (
)

const (
CgroupType = "cgroup.type"
CgroupProcesses = "cgroup.procs"
CgroupThreads = "cgroup.threads"
unifiedMountpoint = "/sys/fs/cgroup"
hybridMountpoint = "/sys/fs/cgroup/unified"
)
Expand Down Expand Up @@ -137,7 +139,14 @@ func GetAllSubsystems() ([]string, error) {
}

func readProcsFile(dir string) ([]int, error) {
f, err := OpenFile(dir, CgroupProcesses, os.O_RDONLY)
var procsFile = CgroupProcesses

Check failure on line 142 in libcontainer/cgroups/utils.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofumpt`-ed (gofumpt)

cgrouptype, err := ReadFile(dir, CgroupType)
if err == nil && string(cgrouptype) == "threaded\n" {

Check failure on line 145 in libcontainer/cgroups/utils.go

View workflow job for this annotation

GitHub Actions / lint

unnecessary conversion (unconvert)
procsFile = CgroupThreads
}

f, err := OpenFile(dir, procsFile, os.O_RDONLY)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit fa31d79

Please sign in to comment.