fix aix nocgo compile

pull/1302/head
xca1075 3 years ago
parent d177019851
commit d4f012c565

@ -5,8 +5,11 @@ package cpu
import ( import (
"context" "context"
"fmt"
"strings" "strings"
"strconv" "strconv"
"github.com/shirou/gopsutil/v3/internal/common"
) )
func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) {
@ -23,10 +26,8 @@ func CountsWithContext(ctx context.Context, logical bool) (int, error) {
return 0, fmt.Errorf("cannot execute prtconf: %s", err) return 0, fmt.Errorf("cannot execute prtconf: %s", err)
} }
for _, line := range strings.Split(string(prtConfOut), "\n") { for _, line := range strings.Split(string(prtConfOut), "\n") {
if parts := strings.Split(line, ": "); len(parts) < 2 { parts := strings.Split(line, ": ")
continue if len(parts) > 1 && parts[0] == "Number Of Processors" {
}
if parts[0] == "Number Of Processors" {
if ncpu, err := strconv.Atoi(parts[1]); err == nil { if ncpu, err := strconv.Atoi(parts[1]); err == nil {
return ncpu, nil return ncpu, nil
} }

@ -5,6 +5,8 @@ package disk
import ( import (
"context" "context"
"github.com/shirou/gopsutil/v3/internal/common"
) )
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) { func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) {

@ -5,6 +5,8 @@ package load
import ( import (
"context" "context"
"github.com/shirou/gopsutil/v3/internal/common"
) )
func AvgWithContext(ctx context.Context) (*AvgStat, error) { func AvgWithContext(ctx context.Context) (*AvgStat, error) {

@ -5,6 +5,8 @@ package mem
import ( import (
"context" "context"
"github.com/shirou/gopsutil/v3/internal/common"
) )
func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) {

@ -6,10 +6,8 @@ package net
import ( import (
"context" "context"
"fmt" "fmt"
"regexp"
"strconv" "strconv"
"strings" "strings"
"syscall"
"github.com/shirou/gopsutil/v3/internal/common" "github.com/shirou/gopsutil/v3/internal/common"
) )

Loading…
Cancel
Save