Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(562)

Unified Diff: runtime/bin/platform_fuchsia.cc

Issue 3006873002: [dart:io] Adds Platform.operatingSystemVersion (Closed)
Patch Set: Updated CHANGELOG Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/platform_android.cc ('k') | runtime/bin/platform_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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";
}
« no previous file with comments | « runtime/bin/platform_android.cc ('k') | runtime/bin/platform_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698