mirror of https://github.com/containers/podman.git
Merge pull request #4920 from openSUSE/cgroup2-super-magic
Use cgroupv2 super magic from golang.org/x/sys/unix
This commit is contained in:
commit
8b377a79c2
|
@ -97,8 +97,7 @@ type controllerHandler interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
cgroupRoot = "/sys/fs/cgroup"
|
cgroupRoot = "/sys/fs/cgroup"
|
||||||
_cgroup2SuperMagic = 0x63677270
|
|
||||||
// CPU is the cpu controller
|
// CPU is the cpu controller
|
||||||
CPU = "cpu"
|
CPU = "cpu"
|
||||||
// CPUAcct is the cpuacct controller
|
// CPUAcct is the cpuacct controller
|
||||||
|
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -27,7 +28,7 @@ func IsCgroup2UnifiedMode() (bool, error) {
|
||||||
if err := syscall.Statfs("/sys/fs/cgroup", &st); err != nil {
|
if err := syscall.Statfs("/sys/fs/cgroup", &st); err != nil {
|
||||||
isUnified, isUnifiedErr = false, err
|
isUnified, isUnifiedErr = false, err
|
||||||
} else {
|
} else {
|
||||||
isUnified, isUnifiedErr = st.Type == _cgroup2SuperMagic, nil
|
isUnified, isUnifiedErr = st.Type == unix.CGROUP2_SUPER_MAGIC, nil
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return isUnified, isUnifiedErr
|
return isUnified, isUnifiedErr
|
||||||
|
|
Loading…
Reference in New Issue