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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « runtime/bin/platform.cc ('k') | runtime/bin/platform_fuchsia.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(HOST_OS_ANDROID) 6 #if defined(HOST_OS_ANDROID)
7 7
8 #include "bin/platform.h" 8 #include "bin/platform.h"
9 9
10 #include <signal.h> // NOLINT 10 #include <signal.h> // NOLINT
11 #include <string.h> // NOLINT 11 #include <string.h> // NOLINT
12 #include <unistd.h> // NOLINT 12 #include <sys/utsname.h> // NOLINT
13 #include <unistd.h> // NOLINT
13 14
14 #include "bin/fdutils.h" 15 #include "bin/fdutils.h"
15 #include "bin/file.h" 16 #include "bin/file.h"
16 17
17 namespace dart { 18 namespace dart {
18 namespace bin { 19 namespace bin {
19 20
20 const char* Platform::executable_name_ = NULL; 21 const char* Platform::executable_name_ = NULL;
21 char* Platform::resolved_executable_name_ = NULL; 22 char* Platform::resolved_executable_name_ = NULL;
22 int Platform::script_index_ = 1; 23 int Platform::script_index_ = 1;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 67 }
67 68
68 int Platform::NumberOfProcessors() { 69 int Platform::NumberOfProcessors() {
69 return sysconf(_SC_NPROCESSORS_ONLN); 70 return sysconf(_SC_NPROCESSORS_ONLN);
70 } 71 }
71 72
72 const char* Platform::OperatingSystem() { 73 const char* Platform::OperatingSystem() {
73 return "android"; 74 return "android";
74 } 75 }
75 76
77 const char* Platform::OperatingSystemVersion() {
78 struct utsname info;
79 int ret = uname(&info);
80 if (ret != 0) {
81 return NULL;
82 }
83 const char* kFormat = "%s %s %s";
84 int len =
85 snprintf(NULL, 0, kFormat, info.sysname, info.release, info.version);
86 if (len <= 0) {
87 return NULL;
88 }
89 char* result = DartUtils::ScopedCString(len + 1);
90 ASSERT(result != NULL);
91 len = snprintf(result, len + 1, kFormat, info.sysname, info.release,
92 info.version);
93 if (len <= 0) {
94 return NULL;
95 }
96 return result;
97 }
98
76 const char* Platform::LibraryPrefix() { 99 const char* Platform::LibraryPrefix() {
77 return "lib"; 100 return "lib";
78 } 101 }
79 102
80 const char* Platform::LibraryExtension() { 103 const char* Platform::LibraryExtension() {
81 return "so"; 104 return "so";
82 } 105 }
83 106
84 const char* Platform::LocaleName() { 107 const char* Platform::LocaleName() {
85 char* lang = getenv("LANG"); 108 char* lang = getenv("LANG");
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 142 }
120 143
121 void Platform::Exit(int exit_code) { 144 void Platform::Exit(int exit_code) {
122 exit(exit_code); 145 exit(exit_code);
123 } 146 }
124 147
125 } // namespace bin 148 } // namespace bin
126 } // namespace dart 149 } // namespace dart
127 150
128 #endif // defined(HOST_OS_ANDROID) 151 #endif // defined(HOST_OS_ANDROID)
OLDNEW
« 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