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 (
|
||||
cgroupRoot = "/sys/fs/cgroup"
|
||||
_cgroup2SuperMagic = 0x63677270
|
||||
cgroupRoot = "/sys/fs/cgroup"
|
||||
// CPU is the cpu controller
|
||||
CPU = "cpu"
|
||||
// CPUAcct is the cpuacct controller
|
||||
|
|
|
@ -12,6 +12,7 @@ import (
|
|||
"syscall"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -27,7 +28,7 @@ func IsCgroup2UnifiedMode() (bool, error) {
|
|||
if err := syscall.Statfs("/sys/fs/cgroup", &st); err != nil {
|
||||
isUnified, isUnifiedErr = false, err
|
||||
} else {
|
||||
isUnified, isUnifiedErr = st.Type == _cgroup2SuperMagic, nil
|
||||
isUnified, isUnifiedErr = st.Type == unix.CGROUP2_SUPER_MAGIC, nil
|
||||
}
|
||||
})
|
||||
return isUnified, isUnifiedErr
|
||||
|
|
Loading…
Reference in New Issue