blob: b38e12c70b24c84506af4781aa4ffa14d6e20deb [file] [log] [blame]
Cosmos Nicolaou39a00e02014-08-14 11:04:14 -07001// +build linux
2
Cosmos Nicolaou6c6fa112014-08-19 13:22:33 -07003package profiles
Cosmos Nicolaou39a00e02014-08-14 11:04:14 -07004
5import (
6 "fmt"
7 "syscall"
8
9 "veyron2"
10 "veyron2/security"
11)
12
Cosmos Nicolaou39a00e02014-08-14 11:04:14 -070013// Platform returns the description of the Platform this process is running on.
14// A default value for veyron2.Platform is provided even if an error is
15// returned; nil is never returned for the first return result.
16func Platform() (*veyron2.Platform, error) {
17 var uts syscall.Utsname
18 if err := syscall.Uname(&uts); err != nil {
19 return &veyron2.Platform{}, err
20 }
21 d := &veyron2.Platform{
22 Vendor: "google",
23 Model: "generic",
Matt Rosencrantz3ab1ea02014-08-18 17:16:45 -070024 System: utsStr(uts.Sysname[:]),
25 Version: utsStr(uts.Version[:]),
26 Release: utsStr(uts.Release[:]),
27 Machine: utsStr(uts.Machine[:]),
28 Node: utsStr(uts.Nodename[:]),
Cosmos Nicolaou39a00e02014-08-14 11:04:14 -070029 }
30 d.Identity = security.FakePublicID(fmt.Sprintf("%s/%s/%s", d.Vendor, d.Model, d.Node))
31 return d, nil
32}