diff --git a/host/host_aix.go b/host/host_aix.go index 32fef28323..67ae1c796d 100644 --- a/host/host_aix.go +++ b/host/host_aix.go @@ -26,10 +26,6 @@ func HostIDWithContext(ctx context.Context) (string, error) { return strings.Split(string(out), "\n")[0], nil } -func numProcs(_ context.Context) (uint64, error) { - return 0, common.ErrNotImplementedError -} - func BootTimeWithContext(ctx context.Context) (btime uint64, err error) { return common.BootTimeWithContext(ctx, invoke) } diff --git a/host/host_aix_cgo.go b/host/host_aix_cgo.go new file mode 100644 index 0000000000..b78ec71fb7 --- /dev/null +++ b/host/host_aix_cgo.go @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build aix && cgo + +package host + +import ( + "context" + + "github.com/power-devops/perfstat" +) + +func numProcs(_ context.Context) (uint64, error) { + procs, err := perfstat.ProcessStat() + if err != nil { + return 0, err + } + return uint64(len(procs)), nil +} diff --git a/host/host_aix_nocgo.go b/host/host_aix_nocgo.go new file mode 100644 index 0000000000..c1fd4b3036 --- /dev/null +++ b/host/host_aix_nocgo.go @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: BSD-3-Clause +//go:build aix && !cgo + +package host + +import ( + "context" + + "github.com/shirou/gopsutil/v4/internal/common" +) + +func numProcs(_ context.Context) (uint64, error) { + return 0, common.ErrNotImplementedError +}