| OLD | NEW |
| 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(TARGET_OS_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
| 7 | 7 |
| 8 #include "bin/platform.h" |
| 9 |
| 8 #if !TARGET_OS_IOS | 10 #if !TARGET_OS_IOS |
| 9 #include <crt_externs.h> // NOLINT | 11 #include <crt_externs.h> // NOLINT |
| 10 #endif // !TARGET_OS_IOS | 12 #endif // !TARGET_OS_IOS |
| 11 #include <mach-o/dyld.h> | 13 #include <mach-o/dyld.h> |
| 12 #include <signal.h> // NOLINT | 14 #include <signal.h> // NOLINT |
| 13 #include <string.h> // NOLINT | 15 #include <string.h> // NOLINT |
| 14 #include <sys/sysctl.h> // NOLINT | 16 #include <sys/sysctl.h> // NOLINT |
| 15 #include <sys/types.h> // NOLINT | 17 #include <sys/types.h> // NOLINT |
| 16 #include <unistd.h> // NOLINT | 18 #include <unistd.h> // NOLINT |
| 17 | 19 |
| 18 #include "bin/fdutils.h" | 20 #include "bin/fdutils.h" |
| 19 #include "bin/file.h" | 21 #include "bin/file.h" |
| 20 #include "bin/platform.h" | |
| 21 | 22 |
| 22 namespace dart { | 23 namespace dart { |
| 23 namespace bin { | 24 namespace bin { |
| 24 | 25 |
| 26 const char* Platform::executable_name_ = NULL; |
| 27 char* Platform::resolved_executable_name_ = NULL; |
| 28 int Platform::script_index_ = 1; |
| 29 char** Platform::argv_ = NULL; |
| 30 |
| 25 bool Platform::Initialize() { | 31 bool Platform::Initialize() { |
| 26 // Turn off the signal handler for SIGPIPE as it causes the process | 32 // Turn off the signal handler for SIGPIPE as it causes the process |
| 27 // to terminate on writing to a closed pipe. Without the signal | 33 // to terminate on writing to a closed pipe. Without the signal |
| 28 // handler error EPIPE is set instead. | 34 // handler error EPIPE is set instead. |
| 29 struct sigaction act; | 35 struct sigaction act; |
| 30 bzero(&act, sizeof(act)); | 36 bzero(&act, sizeof(act)); |
| 31 act.sa_handler = SIG_IGN; | 37 act.sa_handler = SIG_IGN; |
| 32 if (sigaction(SIGPIPE, &act, 0) != 0) { | 38 if (sigaction(SIGPIPE, &act, 0) != 0) { |
| 33 perror("Setting signal handler failed"); | 39 perror("Setting signal handler failed"); |
| 34 return false; | 40 return false; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 124 |
| 119 | 125 |
| 120 void Platform::Exit(int exit_code) { | 126 void Platform::Exit(int exit_code) { |
| 121 exit(exit_code); | 127 exit(exit_code); |
| 122 } | 128 } |
| 123 | 129 |
| 124 } // namespace bin | 130 } // namespace bin |
| 125 } // namespace dart | 131 } // namespace dart |
| 126 | 132 |
| 127 #endif // defined(TARGET_OS_MACOS) | 133 #endif // defined(TARGET_OS_MACOS) |
| OLD | NEW |