mirror of
https://github.com/shirou/gopsutil.git
synced 2025-05-02 22:17:08 +08:00
drop compatibilty with OpenBSD < 6.4
6.3 was EOL'd more than three years ago!
This commit is contained in:
parent
e0ec1b9cda
commit
9203029aae
@ -9,8 +9,6 @@ import (
|
|||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/shirou/gopsutil/v3/internal/common"
|
"github.com/shirou/gopsutil/v3/internal/common"
|
||||||
@ -18,18 +16,17 @@ import (
|
|||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
// sys/sched.h
|
const (
|
||||||
var (
|
// sys/sched.h
|
||||||
CPUser = 0
|
CPUser = 0
|
||||||
cpNice = 1
|
cpNice = 1
|
||||||
cpSys = 2
|
cpSys = 2
|
||||||
cpIntr = 3
|
cpSpin = 3
|
||||||
cpIdle = 4
|
cpIntr = 4
|
||||||
cpUStates = 5
|
cpIdle = 5
|
||||||
)
|
cpUStates = 6
|
||||||
|
|
||||||
// sys/sysctl.h
|
// sys/sysctl.h
|
||||||
const (
|
|
||||||
ctlKern = 1 // "high kernel": proc, limits
|
ctlKern = 1 // "high kernel": proc, limits
|
||||||
ctlHw = 6 // CTL_HW
|
ctlHw = 6 // CTL_HW
|
||||||
sMT = 24 // HW_sMT
|
sMT = 24 // HW_sMT
|
||||||
@ -45,23 +42,6 @@ func init() {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
ClocksPerSec = float64(clkTck)
|
ClocksPerSec = float64(clkTck)
|
||||||
}
|
}
|
||||||
|
|
||||||
func() {
|
|
||||||
v, err := unix.Sysctl("kern.osrelease") // can't reuse host.PlatformInformation because of circular import
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
v = strings.ToLower(v)
|
|
||||||
version, err := strconv.ParseFloat(v, 64)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if version >= 6.4 {
|
|
||||||
cpIntr = 4
|
|
||||||
cpIdle = 5
|
|
||||||
cpUStates = 6
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func smt() (bool, error) {
|
func smt() (bool, error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user