shirou_gopsutil/host/host_posix.go

16 lines
357 B
Go

//go:build linux || freebsd || openbsd || netbsd || darwin || solaris
// +build linux freebsd openbsd netbsd darwin solaris
package host
import "golang.org/x/sys/unix"
func KernelArch() (string, error) {
var utsname unix.Utsname
err := unix.Uname(&utsname)
if err != nil {
return "", err
}
return unix.ByteSliceToString(utsname.Machine[:]), nil
}