fix aix nocgo compile

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

@ -5,8 +5,11 @@ package cpu
import (
"context"
"fmt"
"strings"
"strconv"
"github.com/shirou/gopsutil/v3/internal/common"
)
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)
}
for _, line := range strings.Split(string(prtConfOut), "\n") {
if parts := strings.Split(line, ": "); len(parts) < 2 {
continue
}
if parts[0] == "Number Of Processors" {
parts := strings.Split(line, ": ")
if len(parts) > 1 && parts[0] == "Number Of Processors" {
if ncpu, err := strconv.Atoi(parts[1]); err == nil {
return ncpu, nil
}

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

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

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

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

Loading…
Cancel
Save