~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/github.com/lxc/lxd/shared/architectures_linux.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// +build linux
 
2
 
 
3
package shared
 
4
 
 
5
import (
 
6
        "syscall"
 
7
)
 
8
 
 
9
func ArchitectureGetLocal() (string, error) {
 
10
        uname := syscall.Utsname{}
 
11
        if err := syscall.Uname(&uname); err != nil {
 
12
                return ArchitectureDefault, err
 
13
        }
 
14
 
 
15
        architectureName := ""
 
16
        for _, c := range uname.Machine {
 
17
                if c == 0 {
 
18
                        break
 
19
                }
 
20
                architectureName += string(byte(c))
 
21
        }
 
22
 
 
23
        return architectureName, nil
 
24
}