aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorSascha Grunert <sgrunert@suse.com>2020-01-21 16:08:26 +0100
committerSascha Grunert <sgrunert@suse.com>2020-01-21 16:08:29 +0100
commit2511b508009918c4b20620cead2ef5dd48129069 (patch)
tree1894169da49a3b853f31b5b9fdbb0fcaa0343f3a /pkg
parent9be64300d46341ab345f8c760b7a79cced7db3f9 (diff)
downloadpodman-2511b508009918c4b20620cead2ef5dd48129069.tar.gz
podman-2511b508009918c4b20620cead2ef5dd48129069.tar.bz2
podman-2511b508009918c4b20620cead2ef5dd48129069.zip
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>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/cgroups/cgroups.go3
-rw-r--r--pkg/cgroups/cgroups_supported.go3
2 files changed, 3 insertions, 3 deletions
diff --git a/pkg/cgroups/cgroups.go b/pkg/cgroups/cgroups.go
index 6b28b2759..96786223d 100644
--- a/pkg/cgroups/cgroups.go
+++ b/pkg/cgroups/cgroups.go
@@ -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
diff --git a/pkg/cgroups/cgroups_supported.go b/pkg/cgroups/cgroups_supported.go
index 2a36777d4..a9fef38b9 100644
--- a/pkg/cgroups/cgroups_supported.go
+++ b/pkg/cgroups/cgroups_supported.go
@@ -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