mirror of https://github.com/containers/podman.git
Use cgroupv2 super magic from golang.org/x/sys/unix
We can use this constant from the already existing sys/unix package instead of defining it by our own. Signed-off-by: Sascha Grunert <sgrunert@suse.com>
This commit is contained in:
parent
9be64300d4
commit
2511b50800
|
|
@ -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