Skip to content

Commit

Permalink
Merge pull request #162 from kolyshkin/pids
Browse files Browse the repository at this point in the history
fixes for pkg/sysinfo/checkCgroupPids
  • Loading branch information
giuseppe authored May 23, 2020
2 parents d613ff1 + 6b5ae78 commit 4f08a5f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pkg/sysinfo/sysinfo_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func New(quiet bool) *SysInfo {
sysInfo.cgroupCPUInfo = checkCgroupCPU(cgMounts, quiet)
sysInfo.cgroupBlkioInfo = checkCgroupBlkioInfo(cgMounts, quiet)
sysInfo.cgroupCpusetInfo = checkCgroupCpusetInfo(cgMounts, quiet)
sysInfo.cgroupPids = checkCgroupPids(quiet)
sysInfo.cgroupPids = checkCgroupPids(cgMounts, quiet)
}

_, ok := cgMounts["devices"]
Expand Down Expand Up @@ -227,16 +227,17 @@ func checkCgroupCpusetInfo(cgMounts map[string]string, quiet bool) cgroupCpusetI
}

// checkCgroupPids reads the pids information from the pids cgroup mount point.
func checkCgroupPids(quiet bool) cgroupPids {
func checkCgroupPids(cgMounts map[string]string, quiet bool) cgroupPids {
cgroup2, err := cgroupv2.Enabled()
if err != nil {
logrus.Errorf("Failed to check cgroups version: %v", err)
return cgroupPids{}
}
if !cgroup2 {
_, err := cgroups.FindCgroupMountpoint("", "pids")
if err != nil {
_, ok := cgMounts["pids"]
if !ok {
if !quiet {
logrus.Warn(err)
logrus.Warn("unable to find pids cgroup in mounts")
}
return cgroupPids{}
}
Expand Down

0 comments on commit 4f08a5f

Please sign in to comment.