veyron/runtimes/google/rt: Add special Platform for linux/arm.
Change-Id: I2bd2635c0852cd8da3ac0039ea6cc0b124933e44
diff --git a/runtimes/google/rt/platform_linux.go b/runtimes/google/rt/platform_linux.go
index 1ca3182..0d2a322 100644
--- a/runtimes/google/rt/platform_linux.go
+++ b/runtimes/google/rt/platform_linux.go
@@ -10,19 +10,6 @@
"veyron2/security"
)
-// str converts the input byte slice to a string, ignoring everything following
-// a null character (including the null character).
-func str(c []int8) string {
- ret := make([]byte, 0, len(c))
- for _, v := range c {
- if v == 0 {
- break
- }
- ret = append(ret, byte(v))
- }
- return string(ret)
-}
-
// Platform returns the description of the Platform this process is running on.
// A default value for veyron2.Platform is provided even if an error is
// returned; nil is never returned for the first return result.
@@ -34,11 +21,11 @@
d := &veyron2.Platform{
Vendor: "google",
Model: "generic",
- System: str(uts.Sysname[:]),
- Version: str(uts.Version[:]),
- Release: str(uts.Release[:]),
- Machine: str(uts.Machine[:]),
- Node: str(uts.Nodename[:]),
+ System: utsStr(uts.Sysname[:]),
+ Version: utsStr(uts.Version[:]),
+ Release: utsStr(uts.Release[:]),
+ Machine: utsStr(uts.Machine[:]),
+ Node: utsStr(uts.Nodename[:]),
}
d.Identity = security.FakePublicID(fmt.Sprintf("%s/%s/%s", d.Vendor, d.Model, d.Node))
return d, nil
diff --git a/runtimes/google/rt/uts_str_linux_arm.go b/runtimes/google/rt/uts_str_linux_arm.go
new file mode 100644
index 0000000..a3cee4e
--- /dev/null
+++ b/runtimes/google/rt/uts_str_linux_arm.go
@@ -0,0 +1,16 @@
+// +build linux,arm
+
+package rt
+
+// str converts the input byte slice to a string, ignoring everything following
+// a null character (including the null character).
+func utsStr(c []uint8) string {
+ ret := make([]byte, 0, len(c))
+ for _, v := range c {
+ if v == 0 {
+ break
+ }
+ ret = append(ret, byte(v))
+ }
+ return string(ret)
+}
diff --git a/runtimes/google/rt/uts_str_linux_nonarm.go b/runtimes/google/rt/uts_str_linux_nonarm.go
new file mode 100644
index 0000000..02b8f81
--- /dev/null
+++ b/runtimes/google/rt/uts_str_linux_nonarm.go
@@ -0,0 +1,16 @@
+// +build linux,!arm
+
+package rt
+
+// str converts the input byte slice to a string, ignoring everything following
+// a null character (including the null character).
+func utsStr(c []int8) string {
+ ret := make([]byte, 0, len(c))
+ for _, v := range c {
+ if v == 0 {
+ break
+ }
+ ret = append(ret, byte(v))
+ }
+ return string(ret)
+}