vendor: update elastic/gosigar so that it compiles on OpenBSD (#16542)
This commit is contained in:
parent
b15eb665ee
commit
744428cb03
11
vendor/github.com/elastic/gosigar/CHANGELOG.md
generated
vendored
11
vendor/github.com/elastic/gosigar/CHANGELOG.md
generated
vendored
@ -8,10 +8,21 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Added missing runtime import for FreeBSD. #104
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
|
## [0.9.0]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Added support for huge TLB pages on Linux #97
|
||||||
|
- Added support for big endian platform #100
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Add missing method for OpenBSD #99
|
||||||
|
|
||||||
## [0.8.0]
|
## [0.8.0]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
1
vendor/github.com/elastic/gosigar/README.md
generated
vendored
1
vendor/github.com/elastic/gosigar/README.md
generated
vendored
@ -26,6 +26,7 @@ The features vary by operating system.
|
|||||||
| FDUsage | X | | | | X |
|
| FDUsage | X | | | | X |
|
||||||
| FileSystemList | X | X | X | X | X |
|
| FileSystemList | X | X | X | X | X |
|
||||||
| FileSystemUsage | X | X | X | X | X |
|
| FileSystemUsage | X | X | X | X | X |
|
||||||
|
| HugeTLBPages | X | | | | |
|
||||||
| LoadAverage | X | X | | X | X |
|
| LoadAverage | X | X | | X | X |
|
||||||
| Mem | X | X | X | X | X |
|
| Mem | X | X | X | X | X |
|
||||||
| ProcArgs | X | X | X | | X |
|
| ProcArgs | X | X | X | | X |
|
||||||
|
6
vendor/github.com/elastic/gosigar/concrete_sigar.go
generated
vendored
6
vendor/github.com/elastic/gosigar/concrete_sigar.go
generated
vendored
@ -62,6 +62,12 @@ func (c *ConcreteSigar) GetSwap() (Swap, error) {
|
|||||||
return s, err
|
return s, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *ConcreteSigar) GetHugeTLBPages() (HugeTLBPages, error) {
|
||||||
|
p := HugeTLBPages{}
|
||||||
|
err := p.Get()
|
||||||
|
return p, err
|
||||||
|
}
|
||||||
|
|
||||||
func (c *ConcreteSigar) GetFileSystemUsage(path string) (FileSystemUsage, error) {
|
func (c *ConcreteSigar) GetFileSystemUsage(path string) (FileSystemUsage, error) {
|
||||||
f := FileSystemUsage{}
|
f := FileSystemUsage{}
|
||||||
err := f.Get(path)
|
err := f.Get(path)
|
||||||
|
4
vendor/github.com/elastic/gosigar/sigar_darwin.go
generated
vendored
4
vendor/github.com/elastic/gosigar/sigar_darwin.go
generated
vendored
@ -91,6 +91,10 @@ func (self *Swap) Get() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *HugeTLBPages) Get() error {
|
||||||
|
return ErrNotImplemented{runtime.GOOS}
|
||||||
|
}
|
||||||
|
|
||||||
func (self *Cpu) Get() error {
|
func (self *Cpu) Get() error {
|
||||||
var count C.mach_msg_type_number_t = C.HOST_CPU_LOAD_INFO_COUNT
|
var count C.mach_msg_type_number_t = C.HOST_CPU_LOAD_INFO_COUNT
|
||||||
var cpuload C.host_cpu_load_info_data_t
|
var cpuload C.host_cpu_load_info_data_t
|
||||||
|
5
vendor/github.com/elastic/gosigar/sigar_freebsd.go
generated
vendored
5
vendor/github.com/elastic/gosigar/sigar_freebsd.go
generated
vendored
@ -4,6 +4,7 @@ package gosigar
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
@ -97,6 +98,10 @@ func (self *ProcFDUsage) Get(pid int) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *HugeTLBPages) Get() error {
|
||||||
|
return ErrNotImplemented{runtime.GOOS}
|
||||||
|
}
|
||||||
|
|
||||||
func parseCpuStat(self *Cpu, line string) error {
|
func parseCpuStat(self *Cpu, line string) error {
|
||||||
fields := strings.Fields(line)
|
fields := strings.Fields(line)
|
||||||
|
|
||||||
|
10
vendor/github.com/elastic/gosigar/sigar_interface.go
generated
vendored
10
vendor/github.com/elastic/gosigar/sigar_interface.go
generated
vendored
@ -26,6 +26,7 @@ type Sigar interface {
|
|||||||
GetLoadAverage() (LoadAverage, error)
|
GetLoadAverage() (LoadAverage, error)
|
||||||
GetMem() (Mem, error)
|
GetMem() (Mem, error)
|
||||||
GetSwap() (Swap, error)
|
GetSwap() (Swap, error)
|
||||||
|
GetHugeTLBPages(HugeTLBPages, error)
|
||||||
GetFileSystemUsage(string) (FileSystemUsage, error)
|
GetFileSystemUsage(string) (FileSystemUsage, error)
|
||||||
GetFDUsage() (FDUsage, error)
|
GetFDUsage() (FDUsage, error)
|
||||||
GetRusage(who int) (Rusage, error)
|
GetRusage(who int) (Rusage, error)
|
||||||
@ -82,6 +83,15 @@ type Swap struct {
|
|||||||
Free uint64
|
Free uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type HugeTLBPages struct {
|
||||||
|
Total uint64
|
||||||
|
Free uint64
|
||||||
|
Reserved uint64
|
||||||
|
Surplus uint64
|
||||||
|
DefaultSize uint64
|
||||||
|
TotalAllocatedSize uint64
|
||||||
|
}
|
||||||
|
|
||||||
type CpuList struct {
|
type CpuList struct {
|
||||||
List []Cpu
|
List []Cpu
|
||||||
}
|
}
|
||||||
|
24
vendor/github.com/elastic/gosigar/sigar_linux.go
generated
vendored
24
vendor/github.com/elastic/gosigar/sigar_linux.go
generated
vendored
@ -45,6 +45,30 @@ func (self *FDUsage) Get() error {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *HugeTLBPages) Get() error {
|
||||||
|
table, err := parseMeminfo()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
self.Total, _ = table["HugePages_Total"]
|
||||||
|
self.Free, _ = table["HugePages_Free"]
|
||||||
|
self.Reserved, _ = table["HugePages_Rsvd"]
|
||||||
|
self.Surplus, _ = table["HugePages_Surp"]
|
||||||
|
self.DefaultSize, _ = table["Hugepagesize"]
|
||||||
|
|
||||||
|
if totalSize, found := table["Hugetlb"]; found {
|
||||||
|
self.TotalAllocatedSize = totalSize
|
||||||
|
} else {
|
||||||
|
// If Hugetlb is not present, or huge pages of different sizes
|
||||||
|
// are used, this figure can be unaccurate.
|
||||||
|
// TODO (jsoriano): Extract information from /sys/kernel/mm/hugepages too
|
||||||
|
self.TotalAllocatedSize = (self.Total - self.Free + self.Reserved) * self.DefaultSize
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (self *ProcFDUsage) Get(pid int) error {
|
func (self *ProcFDUsage) Get(pid int) error {
|
||||||
err := readFile(procFileName(pid, "limits"), func(line string) bool {
|
err := readFile(procFileName(pid, "limits"), func(line string) bool {
|
||||||
if strings.HasPrefix(line, "Max open files") {
|
if strings.HasPrefix(line, "Max open files") {
|
||||||
|
22
vendor/github.com/elastic/gosigar/sigar_linux_common.go
generated
vendored
22
vendor/github.com/elastic/gosigar/sigar_linux_common.go
generated
vendored
@ -379,12 +379,16 @@ func parseMeminfo() (map[string]uint64, error) {
|
|||||||
return true // skip on errors
|
return true // skip on errors
|
||||||
}
|
}
|
||||||
|
|
||||||
num := strings.TrimLeft(fields[1], " ")
|
valueUnit := strings.Fields(fields[1])
|
||||||
val, err := strtoull(strings.Fields(num)[0])
|
value, err := strtoull(valueUnit[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return true // skip on errors
|
return true // skip on errors
|
||||||
}
|
}
|
||||||
table[fields[0]] = val * 1024 //in bytes
|
|
||||||
|
if len(valueUnit) > 1 && valueUnit[1] == "kB" {
|
||||||
|
value *= 1024
|
||||||
|
}
|
||||||
|
table[fields[0]] = value
|
||||||
|
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
@ -420,8 +424,18 @@ func procFileName(pid int, name string) string {
|
|||||||
return Procd + "/" + strconv.Itoa(pid) + "/" + name
|
return Procd + "/" + strconv.Itoa(pid) + "/" + name
|
||||||
}
|
}
|
||||||
|
|
||||||
func readProcFile(pid int, name string) ([]byte, error) {
|
func readProcFile(pid int, name string) (content []byte, err error) {
|
||||||
path := procFileName(pid, name)
|
path := procFileName(pid, name)
|
||||||
|
|
||||||
|
// Panics have been reported when reading proc files, let's recover and
|
||||||
|
// report the path if this happens
|
||||||
|
// See https://github.com/elastic/beats/issues/6692
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
content = nil
|
||||||
|
err = fmt.Errorf("recovered panic when reading proc file '%s': %v", path, r)
|
||||||
|
}
|
||||||
|
}()
|
||||||
contents, err := ioutil.ReadFile(path)
|
contents, err := ioutil.ReadFile(path)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
8
vendor/github.com/elastic/gosigar/sigar_openbsd.go
generated
vendored
8
vendor/github.com/elastic/gosigar/sigar_openbsd.go
generated
vendored
@ -294,6 +294,10 @@ func (self *Swap) Get() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *HugeTLBPages) Get() error {
|
||||||
|
return ErrNotImplemented{runtime.GOOS}
|
||||||
|
}
|
||||||
|
|
||||||
func (self *Cpu) Get() error {
|
func (self *Cpu) Get() error {
|
||||||
load := [C.CPUSTATES]C.long{C.CP_USER, C.CP_NICE, C.CP_SYS, C.CP_INTR, C.CP_IDLE}
|
load := [C.CPUSTATES]C.long{C.CP_USER, C.CP_NICE, C.CP_SYS, C.CP_INTR, C.CP_IDLE}
|
||||||
|
|
||||||
@ -381,6 +385,10 @@ func (self *ProcFDUsage) Get(pid int) error {
|
|||||||
return ErrNotImplemented{runtime.GOOS}
|
return ErrNotImplemented{runtime.GOOS}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *Rusage) Get(pid int) error {
|
||||||
|
return ErrNotImplemented{runtime.GOOS}
|
||||||
|
}
|
||||||
|
|
||||||
func fillCpu(cpu *Cpu, load [C.CPUSTATES]C.long) {
|
func fillCpu(cpu *Cpu, load [C.CPUSTATES]C.long) {
|
||||||
cpu.User = uint64(load[0])
|
cpu.User = uint64(load[0])
|
||||||
cpu.Nice = uint64(load[1])
|
cpu.Nice = uint64(load[1])
|
||||||
|
4
vendor/github.com/elastic/gosigar/sigar_stub.go
generated
vendored
4
vendor/github.com/elastic/gosigar/sigar_stub.go
generated
vendored
@ -22,6 +22,10 @@ func (s *Swap) Get() error {
|
|||||||
return ErrNotImplemented{runtime.GOOS}
|
return ErrNotImplemented{runtime.GOOS}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *HugeTLBPages) Get() error {
|
||||||
|
return ErrNotImplemented{runtime.GOOS}
|
||||||
|
}
|
||||||
|
|
||||||
func (f *FDUsage) Get() error {
|
func (f *FDUsage) Get() error {
|
||||||
return ErrNotImplemented{runtime.GOOS}
|
return ErrNotImplemented{runtime.GOOS}
|
||||||
}
|
}
|
||||||
|
4
vendor/github.com/elastic/gosigar/sigar_windows.go
generated
vendored
4
vendor/github.com/elastic/gosigar/sigar_windows.go
generated
vendored
@ -120,6 +120,10 @@ func (self *Swap) Get() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *HugeTLBPages) Get() error {
|
||||||
|
return ErrNotImplemented{runtime.GOOS}
|
||||||
|
}
|
||||||
|
|
||||||
func (self *Cpu) Get() error {
|
func (self *Cpu) Get() error {
|
||||||
idle, kernel, user, err := windows.GetSystemTimes()
|
idle, kernel, user, err := windows.GetSystemTimes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
6
vendor/vendor.json
vendored
6
vendor/vendor.json
vendored
@ -93,10 +93,10 @@
|
|||||||
"revisionTime": "2016-05-12T03:30:02Z"
|
"revisionTime": "2016-05-12T03:30:02Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "Fc8BCxCoQ7ZmghDT6X1cASR10Ec=",
|
"checksumSHA1": "jElNoLEe7m/iaoF1vYIHyNaS2SE=",
|
||||||
"path": "github.com/elastic/gosigar",
|
"path": "github.com/elastic/gosigar",
|
||||||
"revision": "a3814ce5008e612a0c6d027608b54e1d0d9a5613",
|
"revision": "37f05ff46ffa7a825d1b24cf2b62d4a4c1a9d2e8",
|
||||||
"revisionTime": "2018-01-22T22:25:45Z"
|
"revisionTime": "2018-03-30T10:04:40Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "qDsgp2kAeI9nhj565HUScaUyjU4=",
|
"checksumSHA1": "qDsgp2kAeI9nhj565HUScaUyjU4=",
|
||||||
|
Loading…
Reference in New Issue
Block a user