Index: runtime/bin/platform_fuchsia.cc |
diff --git a/runtime/bin/platform_fuchsia.cc b/runtime/bin/platform_fuchsia.cc |
index b322b439acf9c309ba7482863849e346f3130d5c..320bc9fe6a0feee2c0c0b87404b76d60f69549be 100644 |
--- a/runtime/bin/platform_fuchsia.cc |
+++ b/runtime/bin/platform_fuchsia.cc |
@@ -11,6 +11,7 @@ |
#include <magenta/status.h> |
#include <magenta/syscalls.h> |
#include <string.h> |
+#include <sys/utsname.h> |
#include <unistd.h> |
#include "bin/dartutils.h" |
@@ -37,6 +38,28 @@ const char* Platform::OperatingSystem() { |
return "fuchsia"; |
} |
+const char* Platform::OperatingSystemVersion() { |
+ struct utsname info; |
+ int ret = uname(&info); |
+ if (ret != 0) { |
+ return NULL; |
+ } |
+ const char* kFormat = "%s %s %s"; |
+ int len = |
+ snprintf(NULL, 0, kFormat, info.sysname, info.release, info.version); |
+ if (len <= 0) { |
+ return NULL; |
+ } |
+ char* result = DartUtils::ScopedCString(len + 1); |
+ ASSERT(result != NULL); |
+ len = snprintf(result, len + 1, kFormat, info.sysname, info.release, |
+ info.version); |
+ if (len <= 0) { |
+ return NULL; |
+ } |
+ return result; |
+} |
+ |
const char* Platform::LibraryPrefix() { |
return "lib"; |
} |