2023-09-16 17:44:58 +08:00
|
|
|
//go:build linux || freebsd || openbsd || netbsd || darwin || solaris
|
|
|
|
// +build linux freebsd openbsd netbsd darwin solaris
|
2019-08-08 05:59:43 +08:00
|
|
|
|
|
|
|
package host
|
|
|
|
|
2022-12-07 20:14:45 +08:00
|
|
|
import "golang.org/x/sys/unix"
|
2019-08-08 05:59:43 +08:00
|
|
|
|
2020-09-11 19:51:20 +08:00
|
|
|
func KernelArch() (string, error) {
|
2019-08-08 05:59:43 +08:00
|
|
|
var utsname unix.Utsname
|
|
|
|
err := unix.Uname(&utsname)
|
2022-12-07 20:14:45 +08:00
|
|
|
if err != nil {
|
|
|
|
return "", err
|
|
|
|
}
|
|
|
|
return unix.ByteSliceToString(utsname.Machine[:]), nil
|
2019-08-08 05:59:43 +08:00
|
|
|
}
|