Merge pull request #44 from rhatdan/version
Fix definitions for cross compilers
This commit is contained in:
commit
beb649a713
|
|
@ -7,7 +7,6 @@ import (
|
|||
"path/filepath"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"syscall"
|
||||
|
||||
"github.com/containers/common/pkg/unshare"
|
||||
"github.com/containers/storage"
|
||||
|
|
@ -113,22 +112,6 @@ const (
|
|||
SeccompDefaultPath = _installPrefix + "/share/containers/seccomp.json"
|
||||
)
|
||||
|
||||
const (
|
||||
cgroupRoot = "/sys/fs/cgroup"
|
||||
_cgroup2SuperMagic = 0x63677270
|
||||
)
|
||||
|
||||
// isCgroup2UnifiedMode returns whether we are running in cgroup 2 cgroup2 mode.
|
||||
func isCgroup2UnifiedMode() (isUnified bool, isUnifiedErr error) {
|
||||
var st syscall.Statfs_t
|
||||
if err := syscall.Statfs(cgroupRoot, &st); err != nil {
|
||||
isUnified, isUnifiedErr = false, err
|
||||
} else {
|
||||
isUnified, isUnifiedErr = st.Type == _cgroup2SuperMagic, nil
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DefaultConfig defines the default values from containers.conf
|
||||
func DefaultConfig() (*Config, error) {
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// isCgroup2UnifiedMode returns whether we are running in cgroup2 mode.
|
||||
func isCgroup2UnifiedMode() (isUnified bool, isUnifiedErr error) {
|
||||
_cgroup2SuperMagic := int64(0x63677270)
|
||||
cgroupRoot := "/sys/fs/cgroup"
|
||||
|
||||
var st syscall.Statfs_t
|
||||
if err := syscall.Statfs(cgroupRoot, &st); err != nil {
|
||||
isUnified, isUnifiedErr = false, err
|
||||
} else {
|
||||
isUnified, isUnifiedErr = st.Type == _cgroup2SuperMagic, nil
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// +build !linux
|
||||
|
||||
package config
|
||||
|
||||
// isCgroup2UnifiedMode returns whether we are running in cgroup2 mode.
|
||||
func isCgroup2UnifiedMode() (isUnified bool, isUnifiedErr error) {
|
||||
return false, nil
|
||||
}
|
||||
Loading…
Reference in New Issue