gopsutil icon indicating copy to clipboard operation
gopsutil copied to clipboard

AIX Support Coming?

Open serak opened this issue 2 years ago • 5 comments

Is your feature request related to a problem? Please describe. No, but psutil support this os Describe the solution you'd like AIX/ppc64 support Describe alternatives you've considered psutil

serak avatar Jul 05 '23 16:07 serak

We don't have access to this kind of hardware/operating system, we have to rely on external contributions for this (like in https://github.com/shirou/gopsutil/pull/834#issuecomment-593023654).

We already partially support aix

cpu/cpu_aix.go
cpu/cpu_aix_cgo.go
cpu/cpu_aix_nocgo.go
disk/disk_aix.go
disk/disk_aix_cgo.go
disk/disk_aix_nocgo.go
load/load_aix.go
load/load_aix_cgo.go
load/load_aix_nocgo.go
mem/mem_aix.go
mem/mem_aix_cgo.go
mem/mem_aix_nocgo.go
net/net_aix.go
net/net_aix_cgo.go
net/net_aix_nocgo.go

Can you confirm you are missing the host and process sub-packages? Can you confirm the cpu, disk, load, mem and net sub-packages are functional on aix/ppc64?

Lomanic avatar Jul 06 '23 09:07 Lomanic

Ok the provided example works fine on Power8 (Go Support) .

is there a test bench that i can execute for all functions ?

image

serak avatar Jul 06 '23 11:07 serak

image

cpu.Info() is also very expensive, because it is calling prtconf , how is the standard here if i want to make a pull request should i call processes and get values of use native C library?

serak avatar Jul 06 '23 15:07 serak

cpu.Info() shells out to an external process only if you disable cgo ( CGO_ENABLED=0), it's defined twice in https://github.com/shirou/gopsutil/blob/042e63609b4e22a95b6201d48c874b62a976d133/cpu/cpu_aix_nocgo.go#L53 and https://github.com/shirou/gopsutil/blob/master/cpu/cpu_aix_cgo.go#L46

If you were to implement the missing packages with cgo, please add nocgo stubs like in https://github.com/shirou/gopsutil/blob/042e63609b4e22a95b6201d48c874b62a976d133/disk/disk_darwin_nocgo.go

There are tests for each packages, you can run all of them with go test github.com/shirou/gopsutil/v3/...

Lomanic avatar Jul 06 '23 19:07 Lomanic

Host version detection: https://github.com/jxsl13/osfacts/blob/master/distro/distro_aix.go#L21

jxsl13 avatar Aug 11 '23 15:08 jxsl13

I'll be working on this here: https://github.com/Dylan-M/gopsutil/tree/aix_support

However, it will likely only be for nocgo support, since my software using it doesn't enable cgo. I'll make best effort to support it with cgo enabled as well.

Dylan-M avatar May 15 '24 00:05 Dylan-M

Host version detection: https://github.com/jxsl13/osfacts/blob/master/distro/distro_aix.go#L21

Why specifically did you reference this?

Dylan-M avatar May 15 '24 01:05 Dylan-M

I've implemented everything that I both have time to do, and is within my capabilities (I'm new at Golang) in #1651

This greatly improves AIX support in general, and covers all of my own use cases except processes. I hope to have time for that later.

Dylan-M avatar May 18 '24 04:05 Dylan-M

Close as completed by #1651. Thank you for your contribution!

shirou avatar Jun 15 '24 08:06 shirou