2019-08-08 05:59:43 +08:00
|
|
|
// +build linux freebsd openbsd darwin solaris
|
|
|
|
|
|
|
|
package host
|
|
|
|
|
|
|
|
import (
|
2019-08-13 04:32:14 +08:00
|
|
|
"bytes"
|
|
|
|
|
2019-08-08 05:59:43 +08:00
|
|
|
"golang.org/x/sys/unix"
|
|
|
|
)
|
|
|
|
|
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)
|
2019-08-13 04:32:14 +08:00
|
|
|
return string(utsname.Machine[:bytes.IndexByte(utsname.Machine[:], 0)]), err
|
2019-08-08 05:59:43 +08:00
|
|
|
}
|