use sys/unix package instead of syscall (#1340)
According to the golang docs, the syscall package is deprecated. https://golang.org/pkg/syscall This updates collectors to use the x/sys/unix package instead. Also updates the vendored x/sys/unix module to latest. Signed-off-by: Paul Gier <pgier@redhat.com>
This commit is contained in:
parent
f97f01c46c
commit
d0a66c4c40
39 changed files with 2942 additions and 19 deletions
|
|
@ -18,7 +18,6 @@ package collector
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
|
|
@ -98,16 +97,16 @@ func (b bsdSysctl) getStructTimeval() (float64, error) {
|
|||
return 0, err
|
||||
}
|
||||
|
||||
if len(raw) != int(unsafe.Sizeof(syscall.Timeval{})) {
|
||||
if len(raw) != int(unsafe.Sizeof(unix.Timeval{})) {
|
||||
// Shouldn't get here.
|
||||
return 0, fmt.Errorf(
|
||||
"length of bytes received from sysctl (%d) does not match expected bytes (%d)",
|
||||
len(raw),
|
||||
unsafe.Sizeof(syscall.Timeval{}),
|
||||
unsafe.Sizeof(unix.Timeval{}),
|
||||
)
|
||||
}
|
||||
|
||||
tv := *(*syscall.Timeval)(unsafe.Pointer(&raw[0]))
|
||||
tv := *(*unix.Timeval)(unsafe.Pointer(&raw[0]))
|
||||
|
||||
// This conversion maintains the usec precision. Using the time
|
||||
// package did not.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue