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" | 8 #include "bin/platform.h" |
9 | 9 |
10 #if !TARGET_OS_IOS | 10 #if !TARGET_OS_IOS |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 return false; | 52 return false; |
53 } | 53 } |
54 if (sigaddset(&act.sa_mask, SIGPROF) != 0) { | 54 if (sigaddset(&act.sa_mask, SIGPROF) != 0) { |
55 perror("sigaddset() failed"); | 55 perror("sigaddset() failed"); |
56 return false; | 56 return false; |
57 } | 57 } |
58 if (sigaction(SIGSEGV, &act, NULL) != 0) { | 58 if (sigaction(SIGSEGV, &act, NULL) != 0) { |
59 perror("sigaction() failed."); | 59 perror("sigaction() failed."); |
60 return false; | 60 return false; |
61 } | 61 } |
| 62 if (sigaction(SIGTRAP, &act, NULL) != 0) { |
| 63 perror("sigaction() failed."); |
| 64 return false; |
| 65 } |
62 return true; | 66 return true; |
63 } | 67 } |
64 | 68 |
65 | 69 |
66 int Platform::NumberOfProcessors() { | 70 int Platform::NumberOfProcessors() { |
67 int32_t cpus = -1; | 71 int32_t cpus = -1; |
68 size_t cpus_length = sizeof(cpus); | 72 size_t cpus_length = sizeof(cpus); |
69 if (sysctlbyname("hw.logicalcpu", &cpus, &cpus_length, NULL, 0) == 0) { | 73 if (sysctlbyname("hw.logicalcpu", &cpus, &cpus_length, NULL, 0) == 0) { |
70 return cpus; | 74 return cpus; |
71 } else { | 75 } else { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 155 |
152 | 156 |
153 void Platform::Exit(int exit_code) { | 157 void Platform::Exit(int exit_code) { |
154 exit(exit_code); | 158 exit(exit_code); |
155 } | 159 } |
156 | 160 |
157 } // namespace bin | 161 } // namespace bin |
158 } // namespace dart | 162 } // namespace dart |
159 | 163 |
160 #endif // defined(TARGET_OS_MACOS) | 164 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |