| Index: runtime/bin/platform_fuchsia.cc
|
| diff --git a/runtime/bin/platform_android.cc b/runtime/bin/platform_fuchsia.cc
|
| similarity index 52%
|
| copy from runtime/bin/platform_android.cc
|
| copy to runtime/bin/platform_fuchsia.cc
|
| index 3d1a7640b6d570d12d063eec1491efd3eb2634f5..ace3c37128ebd9ad3b9550c4c2ef26b33da5b46f 100644
|
| --- a/runtime/bin/platform_android.cc
|
| +++ b/runtime/bin/platform_fuchsia.cc
|
| @@ -1,13 +1,13 @@
|
| -// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
| +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| #include "platform/globals.h"
|
| -#if defined(TARGET_OS_ANDROID)
|
| +#if defined(TARGET_OS_FUCHSIA)
|
|
|
| #include "bin/platform.h"
|
|
|
| -#include <signal.h> // NOLINT
|
| +#include <runtime/sysinfo.h>
|
| #include <string.h> // NOLINT
|
| #include <unistd.h> // NOLINT
|
|
|
| @@ -23,27 +23,17 @@ int Platform::script_index_ = 1;
|
| char** Platform::argv_ = NULL;
|
|
|
| bool Platform::Initialize() {
|
| - // Turn off the signal handler for SIGPIPE as it causes the process
|
| - // to terminate on writing to a closed pipe. Without the signal
|
| - // handler error EPIPE is set instead.
|
| - struct sigaction act;
|
| - bzero(&act, sizeof(act));
|
| - act.sa_handler = SIG_IGN;
|
| - if (sigaction(SIGPIPE, &act, 0) != 0) {
|
| - perror("Setting signal handler failed");
|
| - return false;
|
| - }
|
| return true;
|
| }
|
|
|
|
|
| int Platform::NumberOfProcessors() {
|
| - return sysconf(_SC_NPROCESSORS_ONLN);
|
| + return mxr_get_nprocs();
|
| }
|
|
|
|
|
| const char* Platform::OperatingSystem() {
|
| - return "android";
|
| + return "fuchsia";
|
| }
|
|
|
|
|
| @@ -63,25 +53,15 @@ bool Platform::LocalHostname(char *buffer, intptr_t buffer_length) {
|
|
|
|
|
| char** Platform::Environment(intptr_t* count) {
|
| - // Using environ directly is only safe as long as we do not
|
| - // provide access to modifying environment variables.
|
| - intptr_t i = 0;
|
| - char** tmp = environ;
|
| - while (*(tmp++) != NULL) {
|
| - i++;
|
| - }
|
| - *count = i;
|
| - char** result;
|
| - result = reinterpret_cast<char**>(Dart_ScopeAllocate(i * sizeof(*result)));
|
| - for (intptr_t current = 0; current < i; current++) {
|
| - result[current] = environ[current];
|
| - }
|
| + char** result =
|
| + reinterpret_cast<char**>(Dart_ScopeAllocate(1 * sizeof(*result)));
|
| + result[0] = NULL;
|
| return result;
|
| }
|
|
|
|
|
| const char* Platform::ResolveExecutablePath() {
|
| - return NULL;
|
| + return "dart";
|
| }
|
|
|
|
|
| @@ -92,4 +72,4 @@ void Platform::Exit(int exit_code) {
|
| } // namespace bin
|
| } // namespace dart
|
|
|
| -#endif // defined(TARGET_OS_ANDROID)
|
| +#endif // defined(TARGET_OS_FUCHSIA)
|
|
|