Update cAdvisor.

Also update golang.org/x/sys because of google/cadvisor#1786
This commit is contained in:
Rohit Agarwal
2017-11-06 13:54:48 -08:00
parent dad41f8526
commit fe5ef1b494
297 changed files with 10024 additions and 8974 deletions

View File

@@ -16,6 +16,7 @@ go_library(
"//vendor/github.com/google/cadvisor/utils/cloudinfo:go_default_library",
"//vendor/github.com/google/cadvisor/utils/sysfs:go_default_library",
"//vendor/github.com/google/cadvisor/utils/sysinfo:go_default_library",
"//vendor/golang.org/x/sys/unix:go_default_library",
],
)

View File

@@ -22,7 +22,6 @@ import (
"path/filepath"
"strconv"
"strings"
"syscall"
"github.com/google/cadvisor/fs"
info "github.com/google/cadvisor/info/v1"
@@ -31,6 +30,8 @@ import (
"github.com/google/cadvisor/utils/sysinfo"
"github.com/golang/glog"
"golang.org/x/sys/unix"
)
const hugepagesDirectory = "/sys/kernel/mm/hugepages/"
@@ -189,19 +190,11 @@ func ContainerOsVersion() string {
}
func KernelVersion() string {
uname := &syscall.Utsname{}
uname := &unix.Utsname{}
if err := syscall.Uname(uname); err != nil {
if err := unix.Uname(uname); err != nil {
return "Unknown"
}
release := make([]byte, len(uname.Release))
i := 0
for _, c := range uname.Release {
release[i] = byte(c)
i++
}
release = release[:bytes.IndexByte(release, 0)]
return string(release)
return string(uname.Release[:bytes.IndexByte(uname.Release[:], 0)])
}

View File

@@ -24,7 +24,6 @@ import (
// s390/s390x changes
"runtime"
"syscall"
info "github.com/google/cadvisor/info/v1"
"github.com/google/cadvisor/utils"
@@ -32,6 +31,8 @@ import (
"github.com/google/cadvisor/utils/sysinfo"
"github.com/golang/glog"
"golang.org/x/sys/unix"
)
var (
@@ -265,18 +266,13 @@ func addNode(nodes *[]info.Node, id int) (int, error) {
// s390/s390x changes
func getMachineArch() (string, error) {
uname := syscall.Utsname{}
err := syscall.Uname(&uname)
uname := unix.Utsname{}
err := unix.Uname(&uname)
if err != nil {
return "", err
}
var arch string
for _, val := range uname.Machine {
arch += string(int(val))
}
return arch, nil
return string(uname.Machine[:]), nil
}
// arm32 chanes