Fix constant WARNING: No swap limit support on cgroup v2 hosts

Fix issue 43646

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda 2022-05-27 10:51:54 +09:00
parent 2f6b8a2aec
commit a04e3326e7
No known key found for this signature in database
GPG key ID: 49524C6F9F638F1A

View file

@ -56,12 +56,11 @@ func newV2(options ...Opt) *SysInfo {
}
func getSwapLimitV2() bool {
groups, err := cgroups.ParseCgroupFile("/proc/self/cgroup")
_, g, err := cgroups.ParseCgroupFileUnified("/proc/self/cgroup")
if err != nil {
return false
}
g := groups[""]
if g == "" {
return false
}