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/eventhandler.h" | 8 #include "bin/eventhandler.h" |
9 | 9 |
10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 InterruptMessage msg; | 183 InterruptMessage msg; |
184 msg.id = id; | 184 msg.id = id; |
185 msg.dart_port = dart_port; | 185 msg.dart_port = dart_port; |
186 msg.data = data; | 186 msg.data = data; |
187 intptr_t result = | 187 intptr_t result = |
188 FDUtils::WriteToBlocking(interrupt_fds_[1], &msg, kInterruptMessageSize); | 188 FDUtils::WriteToBlocking(interrupt_fds_[1], &msg, kInterruptMessageSize); |
189 if (result != kInterruptMessageSize) { | 189 if (result != kInterruptMessageSize) { |
190 if (result == -1) { | 190 if (result == -1) { |
191 perror("Interrupt message failure:"); | 191 perror("Interrupt message failure:"); |
192 } | 192 } |
193 FATAL1("Interrupt message failure. Wrote %"Pd" bytes.", result); | 193 FATAL1("Interrupt message failure. Wrote %" Pd " bytes.", result); |
194 } | 194 } |
195 } | 195 } |
196 | 196 |
197 | 197 |
198 bool EventHandlerImplementation::GetInterruptMessage(InterruptMessage* msg) { | 198 bool EventHandlerImplementation::GetInterruptMessage(InterruptMessage* msg) { |
199 char* dst = reinterpret_cast<char*>(msg); | 199 char* dst = reinterpret_cast<char*>(msg); |
200 int total_read = 0; | 200 int total_read = 0; |
201 int bytes_read = | 201 int bytes_read = |
202 TEMP_FAILURE_RETRY(read(interrupt_fds_[0], dst, kInterruptMessageSize)); | 202 TEMP_FAILURE_RETRY(read(interrupt_fds_[0], dst, kInterruptMessageSize)); |
203 if (bytes_read < 0) { | 203 if (bytes_read < 0) { |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 | 457 |
458 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { | 458 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { |
459 // The hashmap does not support keys with value 0. | 459 // The hashmap does not support keys with value 0. |
460 return dart::Utils::WordHash(fd + 1); | 460 return dart::Utils::WordHash(fd + 1); |
461 } | 461 } |
462 | 462 |
463 } // namespace bin | 463 } // namespace bin |
464 } // namespace dart | 464 } // namespace dart |
465 | 465 |
466 #endif // defined(TARGET_OS_MACOS) | 466 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |