2021-08-23 09:14:53 -04:00
|
|
|
//go:build !windows
|
2019-09-02 09:56:46 -04:00
|
|
|
// +build !windows
|
2016-03-25 19:38:00 -04:00
|
|
|
|
2016-05-03 12:10:21 -04:00
|
|
|
// Package platform provides helper function to get the runtime architecture
|
|
|
|
// for different platforms.
|
2018-02-05 16:05:59 -05:00
|
|
|
package platform // import "github.com/docker/docker/pkg/platform"
|
2016-03-25 19:38:00 -04:00
|
|
|
|
|
|
|
import (
|
2019-09-02 09:56:46 -04:00
|
|
|
"bytes"
|
|
|
|
|
|
|
|
"golang.org/x/sys/unix"
|
2016-03-25 19:38:00 -04:00
|
|
|
)
|
|
|
|
|
2016-05-03 12:10:21 -04:00
|
|
|
// runtimeArchitecture gets the name of the current architecture (x86, x86_64, i86pc, sun4v, ...)
|
2016-03-25 19:38:00 -04:00
|
|
|
func runtimeArchitecture() (string, error) {
|
2019-09-02 09:56:46 -04:00
|
|
|
utsname := &unix.Utsname{}
|
|
|
|
if err := unix.Uname(utsname); err != nil {
|
2016-03-25 19:38:00 -04:00
|
|
|
return "", err
|
|
|
|
}
|
2019-09-02 09:56:46 -04:00
|
|
|
return string(utsname.Machine[:bytes.IndexByte(utsname.Machine[:], 0)]), nil
|
2016-03-25 19:38:00 -04:00
|
|
|
}
|