aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/elastic
diff options
context:
space:
mode:
authorFabian Raetz <fabian.raetz@gmail.com>2018-04-22 01:19:12 +0800
committerFelix Lange <fjl@users.noreply.github.com>2018-04-22 01:19:12 +0800
commit744428cb03ea8de8f219708f57d2e197acb6689b (patch)
tree8c9b67041fcf5c573b2a57747af3a90e647f3efb /vendor/github.com/elastic
parentb15eb665ee3c373a361b050cd8fc726e31c4a750 (diff)
downloaddexon-744428cb03ea8de8f219708f57d2e197acb6689b.tar
dexon-744428cb03ea8de8f219708f57d2e197acb6689b.tar.gz
dexon-744428cb03ea8de8f219708f57d2e197acb6689b.tar.bz2
dexon-744428cb03ea8de8f219708f57d2e197acb6689b.tar.lz
dexon-744428cb03ea8de8f219708f57d2e197acb6689b.tar.xz
dexon-744428cb03ea8de8f219708f57d2e197acb6689b.tar.zst
dexon-744428cb03ea8de8f219708f57d2e197acb6689b.zip
vendor: update elastic/gosigar so that it compiles on OpenBSD (#16542)
Diffstat (limited to 'vendor/github.com/elastic')
-rw-r--r--vendor/github.com/elastic/gosigar/CHANGELOG.md11
-rw-r--r--vendor/github.com/elastic/gosigar/README.md1
-rw-r--r--vendor/github.com/elastic/gosigar/concrete_sigar.go6
-rw-r--r--vendor/github.com/elastic/gosigar/sigar_darwin.go4
-rw-r--r--vendor/github.com/elastic/gosigar/sigar_freebsd.go5
-rw-r--r--vendor/github.com/elastic/gosigar/sigar_interface.go10
-rw-r--r--vendor/github.com/elastic/gosigar/sigar_linux.go24
-rw-r--r--vendor/github.com/elastic/gosigar/sigar_linux_common.go22
-rw-r--r--vendor/github.com/elastic/gosigar/sigar_openbsd.go8
-rw-r--r--vendor/github.com/elastic/gosigar/sigar_stub.go4
-rw-r--r--vendor/github.com/elastic/gosigar/sigar_windows.go4
11 files changed, 95 insertions, 4 deletions
diff --git a/vendor/github.com/elastic/gosigar/CHANGELOG.md b/vendor/github.com/elastic/gosigar/CHANGELOG.md
index 12695e10e..45262e7b8 100644
--- a/vendor/github.com/elastic/gosigar/CHANGELOG.md
+++ b/vendor/github.com/elastic/gosigar/CHANGELOG.md
@@ -8,10 +8,21 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
+- Added missing runtime import for FreeBSD. #104
+
### Changed
### 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]
### Added
diff --git a/vendor/github.com/elastic/gosigar/README.md b/vendor/github.com/elastic/gosigar/README.md
index 2482620a8..ecdfc1c3c 100644
--- a/vendor/github.com/elastic/gosigar/README.md
+++ b/vendor/github.com/elastic/gosigar/README.md
@@ -26,6 +26,7 @@ The features vary by operating system.
| FDUsage | X | | | | X |
| FileSystemList | X | X | X | X | X |
| FileSystemUsage | X | X | X | X | X |
+| HugeTLBPages | X | | | | |
| LoadAverage | X | X | | X | X |
| Mem | X | X | X | X | X |
| ProcArgs | X | X | X | | X |
diff --git a/vendor/github.com/elastic/gosigar/concrete_sigar.go b/vendor/github.com/elastic/gosigar/concrete_sigar.go
index 685aa6ded..e3ee80a98 100644
--- a/vendor/github.com/elastic/gosigar/concrete_sigar.go
+++ b/vendor/github.com/elastic/gosigar/concrete_sigar.go
@@ -62,6 +62,12 @@ func (c *ConcreteSigar) GetSwap() (Swap, error) {
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) {
f := FileSystemUsage{}
err := f.Get(path)
diff --git a/vendor/github.com/elastic/gosigar/sigar_darwin.go b/vendor/github.com/elastic/gosigar/sigar_darwin.go
index f989f5160..a90b998c2 100644
--- a/vendor/github.com/elastic/gosigar/sigar_darwin.go
+++ b/vendor/github.com/elastic/gosigar/sigar_darwin.go
@@ -91,6 +91,10 @@ func (self *Swap) Get() error {
return nil
}
+func (self *HugeTLBPages) Get() error {
+ return ErrNotImplemented{runtime.GOOS}
+}
+
func (self *Cpu) Get() error {
var count C.mach_msg_type_number_t = C.HOST_CPU_LOAD_INFO_COUNT
var cpuload C.host_cpu_load_info_data_t
diff --git a/vendor/github.com/elastic/gosigar/sigar_freebsd.go b/vendor/github.com/elastic/gosigar/sigar_freebsd.go
index 602b4a0aa..9b2af639b 100644
--- a/vendor/github.com/elastic/gosigar/sigar_freebsd.go
+++ b/vendor/github.com/elastic/gosigar/sigar_freebsd.go
@@ -4,6 +4,7 @@ package gosigar
import (
"io/ioutil"
+ "runtime"
"strconv"
"strings"
"unsafe"
@@ -97,6 +98,10 @@ func (self *ProcFDUsage) Get(pid int) error {
return nil
}
+func (self *HugeTLBPages) Get() error {
+ return ErrNotImplemented{runtime.GOOS}
+}
+
func parseCpuStat(self *Cpu, line string) error {
fields := strings.Fields(line)
diff --git a/vendor/github.com/elastic/gosigar/sigar_interface.go b/vendor/github.com/elastic/gosigar/sigar_interface.go
index a956af604..df79ae08d 100644
--- a/vendor/github.com/elastic/gosigar/sigar_interface.go
+++ b/vendor/github.com/elastic/gosigar/sigar_interface.go
@@ -26,6 +26,7 @@ type Sigar interface {
GetLoadAverage() (LoadAverage, error)
GetMem() (Mem, error)
GetSwap() (Swap, error)
+ GetHugeTLBPages(HugeTLBPages, error)
GetFileSystemUsage(string) (FileSystemUsage, error)
GetFDUsage() (FDUsage, error)
GetRusage(who int) (Rusage, error)
@@ -82,6 +83,15 @@ type Swap struct {
Free uint64
}
+type HugeTLBPages struct {
+ Total uint64
+ Free uint64
+ Reserved uint64
+ Surplus uint64
+ DefaultSize uint64
+ TotalAllocatedSize uint64
+}
+
type CpuList struct {
List []Cpu
}
diff --git a/vendor/github.com/elastic/gosigar/sigar_linux.go b/vendor/github.com/elastic/gosigar/sigar_linux.go
index cb1d3525b..09f2e30b2 100644
--- a/vendor/github.com/elastic/gosigar/sigar_linux.go
+++ b/vendor/github.com/elastic/gosigar/sigar_linux.go
@@ -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 {
err := readFile(procFileName(pid, "limits"), func(line string) bool {
if strings.HasPrefix(line, "Max open files") {
diff --git a/vendor/github.com/elastic/gosigar/sigar_linux_common.go b/vendor/github.com/elastic/gosigar/sigar_linux_common.go
index 8e5e7856f..7ca649762 100644
--- a/vendor/github.com/elastic/gosigar/sigar_linux_common.go
+++ b/vendor/github.com/elastic/gosigar/sigar_linux_common.go
@@ -379,12 +379,16 @@ func parseMeminfo() (map[string]uint64, error) {
return true // skip on errors
}
- num := strings.TrimLeft(fields[1], " ")
- val, err := strtoull(strings.Fields(num)[0])
+ valueUnit := strings.Fields(fields[1])
+ value, err := strtoull(valueUnit[0])
if err != nil {
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
})
@@ -420,8 +424,18 @@ func procFileName(pid int, name string) string {
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)
+
+ // 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)
if err != nil {
diff --git a/vendor/github.com/elastic/gosigar/sigar_openbsd.go b/vendor/github.com/elastic/gosigar/sigar_openbsd.go
index 4f1383a6b..e4371b8b6 100644
--- a/vendor/github.com/elastic/gosigar/sigar_openbsd.go
+++ b/vendor/github.com/elastic/gosigar/sigar_openbsd.go
@@ -294,6 +294,10 @@ func (self *Swap) Get() error {
return nil
}
+func (self *HugeTLBPages) Get() error {
+ return ErrNotImplemented{runtime.GOOS}
+}
+
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}
@@ -381,6 +385,10 @@ func (self *ProcFDUsage) Get(pid int) error {
return ErrNotImplemented{runtime.GOOS}
}
+func (self *Rusage) Get(pid int) error {
+ return ErrNotImplemented{runtime.GOOS}
+}
+
func fillCpu(cpu *Cpu, load [C.CPUSTATES]C.long) {
cpu.User = uint64(load[0])
cpu.Nice = uint64(load[1])
diff --git a/vendor/github.com/elastic/gosigar/sigar_stub.go b/vendor/github.com/elastic/gosigar/sigar_stub.go
index 0b858f1c0..de9565aec 100644
--- a/vendor/github.com/elastic/gosigar/sigar_stub.go
+++ b/vendor/github.com/elastic/gosigar/sigar_stub.go
@@ -22,6 +22,10 @@ func (s *Swap) Get() error {
return ErrNotImplemented{runtime.GOOS}
}
+func (s *HugeTLBPages) Get() error {
+ return ErrNotImplemented{runtime.GOOS}
+}
+
func (f *FDUsage) Get() error {
return ErrNotImplemented{runtime.GOOS}
}
diff --git a/vendor/github.com/elastic/gosigar/sigar_windows.go b/vendor/github.com/elastic/gosigar/sigar_windows.go
index 0cdf928d1..c2b54d8d7 100644
--- a/vendor/github.com/elastic/gosigar/sigar_windows.go
+++ b/vendor/github.com/elastic/gosigar/sigar_windows.go
@@ -120,6 +120,10 @@ func (self *Swap) Get() error {
return nil
}
+func (self *HugeTLBPages) Get() error {
+ return ErrNotImplemented{runtime.GOOS}
+}
+
func (self *Cpu) Get() error {
idle, kernel, user, err := windows.GetSystemTimes()
if err != nil {