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

Unified Diff: runtime/bin/platform_android.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.cc ('k') | runtime/bin/platform_fuchsia.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/platform_android.cc
diff --git a/runtime/bin/platform_android.cc b/runtime/bin/platform_android.cc
index 770c27f05eb4c05963c0d657db5ff97533de6330..7e3f880e3411bdad6763e8c3489a44ceb9344c8d 100644
--- a/runtime/bin/platform_android.cc
+++ b/runtime/bin/platform_android.cc
@@ -7,9 +7,10 @@
#include "bin/platform.h"
-#include <signal.h> // NOLINT
-#include <string.h> // NOLINT
-#include <unistd.h> // NOLINT
+#include <signal.h> // NOLINT
+#include <string.h> // NOLINT
+#include <sys/utsname.h> // NOLINT
+#include <unistd.h> // NOLINT
#include "bin/fdutils.h"
#include "bin/file.h"
@@ -73,6 +74,28 @@ const char* Platform::OperatingSystem() {
return "android";
}
+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.cc ('k') | runtime/bin/platform_fuchsia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698