Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions host/host_aix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
31 changes: 31 additions & 0 deletions host/host_aix_cgo.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// SPDX-License-Identifier: BSD-3-Clause
//go:build aix && cgo

package host

/*
#include <procinfo.h>
*/
import "C"

import (
"context"
"unsafe"
)

func numProcs(_ context.Context) (uint64, error) {
info := C.struct_procentry64{}
cpid := C.pid_t(0)
var count uint64
for {
n, err := C.getprocs64(unsafe.Pointer(&info), C.sizeof_struct_procentry64, nil, 0, &cpid, 1)
if err != nil {
return 0, err
}
if n == 0 {
break
}
count++
}
return count, nil
}
14 changes: 14 additions & 0 deletions host/host_aix_nocgo.go
Original file line number Diff line number Diff line change
@@ -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
}