2015-11-14 22:03:02 +00:00
|
|
|
// Package platform provides helper function to get the runtime architecture
|
|
|
|
// for different platforms.
|
2018-02-05 21:05:59 +00:00
|
|
|
package platform // import "github.com/docker/docker/pkg/platform"
|
2015-11-14 22:03:02 +00:00
|
|
|
|
|
|
|
import (
|
2017-10-31 09:32:03 +00:00
|
|
|
"bytes"
|
|
|
|
|
2017-05-23 14:22:32 +00:00
|
|
|
"golang.org/x/sys/unix"
|
2015-11-14 22:03:02 +00:00
|
|
|
)
|
|
|
|
|
2016-04-09 13:18:15 +00:00
|
|
|
// runtimeArchitecture gets the name of the current architecture (x86, x86_64, …)
|
2015-11-19 13:55:57 +00:00
|
|
|
func runtimeArchitecture() (string, error) {
|
2017-05-23 14:22:32 +00:00
|
|
|
utsname := &unix.Utsname{}
|
|
|
|
if err := unix.Uname(utsname); err != nil {
|
2015-11-14 22:03:02 +00:00
|
|
|
return "", err
|
|
|
|
}
|
2017-10-31 09:32:03 +00:00
|
|
|
return string(utsname.Machine[:bytes.IndexByte(utsname.Machine[:], 0)]), nil
|
2015-11-14 22:03:02 +00:00
|
|
|
}
|