Fix IOCountersForNames on darwin
This commit is contained in:
parent
3f35f001da
commit
ab6db76df1
|
@ -87,10 +87,6 @@ func Partitions(all bool) ([]PartitionStat, error) {
|
|||
return ret, nil
|
||||
}
|
||||
|
||||
func IOCountersForNames(names []string) (map[string]IOCountersStat, error) {
|
||||
return nil, common.ErrNotImplementedError
|
||||
}
|
||||
|
||||
func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
var bufsize uintptr
|
||||
|
|
|
@ -30,9 +30,11 @@ import (
|
|||
"errors"
|
||||
"strings"
|
||||
"unsafe"
|
||||
|
||||
"github.com/shirou/gopsutil/internal/common"
|
||||
)
|
||||
|
||||
func IOCounters() (map[string]IOCountersStat, error) {
|
||||
func IOCountersForNames(names []string) (map[string]IOCountersStat, error) {
|
||||
if C.StartIOCounterFetch() == 0 {
|
||||
return nil, errors.New("Unable to fetch disk list")
|
||||
}
|
||||
|
@ -78,6 +80,10 @@ func IOCounters() (map[string]IOCountersStat, error) {
|
|||
Name: strings.TrimFunc(C.GoStringN(&di.DiskName[0], C.MAX_DISK_NAME), isRuneNull),
|
||||
}
|
||||
|
||||
if len(names) > 0 && !common.StringsHas(names, d.Name) {
|
||||
continue
|
||||
}
|
||||
|
||||
ret[d.Name] = d
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,6 @@ package disk
|
|||
|
||||
import "github.com/shirou/gopsutil/internal/common"
|
||||
|
||||
func IOCounters() (map[string]IOCountersStat, error) {
|
||||
func IOCountersForNames(names []string) (map[string]IOCountersStat, error) {
|
||||
return nil, common.ErrNotImplementedError
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue