mirror of
https://github.com/opencontainers/runc.git
synced 2025-10-10 09:50:26 +08:00

Only some libcontainer packages can be built on non-linux platforms (not that it make sense, but at least go build succeeds). Let's call these "good" packages. For all other packages (i.e. ones that fail to build with GOOS other than linux), it does not make sense to have linux build tag (as they are broken already, and thus are not and can not be used on anything other than Linux). Remove linux build tag for all non-"good" packages. This was mostly done by the following script, with just a few manual fixes on top. function list_good_pkgs() { for pkg in $(find . -type d -print); do GOOS=freebsd go build $pkg 2>/dev/null \ && GOOS=solaris go build $pkg 2>/dev/null \ && echo $pkg done | sed -e 's|^./||' | tr '\n' '|' | sed -e 's/|$//' } function remove_tag() { sed -i -e '\|^// +build linux$|d' $1 go fmt $1 } SKIP="^("$(list_good_pkgs)")" for f in $(git ls-files . | grep .go$); do if echo $f | grep -qE "$SKIP"; then echo skip $f continue fi echo proc $f remove_tag $f done Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
32 lines
708 B
Go
32 lines
708 B
Go
package intelrdt
|
|
|
|
// The flag to indicate if Intel RDT/MBM is enabled
|
|
var mbmEnabled bool
|
|
|
|
// Check if Intel RDT/MBM is enabled.
|
|
func IsMBMEnabled() bool {
|
|
featuresInit()
|
|
return mbmEnabled
|
|
}
|
|
|
|
func getMBMNumaNodeStats(numaPath string) (*MBMNumaNodeStats, error) {
|
|
stats := &MBMNumaNodeStats{}
|
|
if enabledMonFeatures.mbmTotalBytes {
|
|
mbmTotalBytes, err := getIntelRdtParamUint(numaPath, "mbm_total_bytes")
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
stats.MBMTotalBytes = mbmTotalBytes
|
|
}
|
|
|
|
if enabledMonFeatures.mbmLocalBytes {
|
|
mbmLocalBytes, err := getIntelRdtParamUint(numaPath, "mbm_local_bytes")
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
stats.MBMLocalBytes = mbmLocalBytes
|
|
}
|
|
|
|
return stats, nil
|
|
}
|