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_LINUX) | 6 #if defined(TARGET_OS_LINUX) |
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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 InterruptMessage msg; | 164 InterruptMessage msg; |
165 msg.id = id; | 165 msg.id = id; |
166 msg.dart_port = dart_port; | 166 msg.dart_port = dart_port; |
167 msg.data = data; | 167 msg.data = data; |
168 intptr_t result = | 168 intptr_t result = |
169 FDUtils::WriteToBlocking(interrupt_fds_[1], &msg, kInterruptMessageSize); | 169 FDUtils::WriteToBlocking(interrupt_fds_[1], &msg, kInterruptMessageSize); |
170 if (result != kInterruptMessageSize) { | 170 if (result != kInterruptMessageSize) { |
171 if (result == -1) { | 171 if (result == -1) { |
172 perror("Interrupt message failure:"); | 172 perror("Interrupt message failure:"); |
173 } | 173 } |
174 FATAL1("Interrupt message failure. Wrote %"Pd" bytes.", result); | 174 FATAL1("Interrupt message failure. Wrote %" Pd " bytes.", result); |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 | 178 |
179 bool EventHandlerImplementation::GetInterruptMessage(InterruptMessage* msg) { | 179 bool EventHandlerImplementation::GetInterruptMessage(InterruptMessage* msg) { |
180 char* dst = reinterpret_cast<char*>(msg); | 180 char* dst = reinterpret_cast<char*>(msg); |
181 int total_read = 0; | 181 int total_read = 0; |
182 int bytes_read = | 182 int bytes_read = |
183 TEMP_FAILURE_RETRY(read(interrupt_fds_[0], dst, kInterruptMessageSize)); | 183 TEMP_FAILURE_RETRY(read(interrupt_fds_[0], dst, kInterruptMessageSize)); |
184 if (bytes_read < 0) { | 184 if (bytes_read < 0) { |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 | 446 |
447 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { | 447 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { |
448 // The hashmap does not support keys with value 0. | 448 // The hashmap does not support keys with value 0. |
449 return dart::Utils::WordHash(fd + 1); | 449 return dart::Utils::WordHash(fd + 1); |
450 } | 450 } |
451 | 451 |
452 } // namespace bin | 452 } // namespace bin |
453 } // namespace dart | 453 } // namespace dart |
454 | 454 |
455 #endif // defined(TARGET_OS_LINUX) | 455 #endif // defined(TARGET_OS_LINUX) |
OLD | NEW |