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 "bin/eventhandler.h" | 5 #include "bin/eventhandler.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <pthread.h> | 8 #include <pthread.h> |
9 #include <stdio.h> | 9 #include <stdio.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 InterruptMessage msg; | 157 InterruptMessage msg; |
158 msg.id = id; | 158 msg.id = id; |
159 msg.dart_port = dart_port; | 159 msg.dart_port = dart_port; |
160 msg.data = data; | 160 msg.data = data; |
161 intptr_t result = | 161 intptr_t result = |
162 FDUtils::WriteToBlocking(interrupt_fds_[1], &msg, kInterruptMessageSize); | 162 FDUtils::WriteToBlocking(interrupt_fds_[1], &msg, kInterruptMessageSize); |
163 if (result != kInterruptMessageSize) { | 163 if (result != kInterruptMessageSize) { |
164 if (result == -1) { | 164 if (result == -1) { |
165 perror("Interrupt message failure:"); | 165 perror("Interrupt message failure:"); |
166 } | 166 } |
167 FATAL1("Interrupt message failure. Wrote %d bytes.", result); | 167 FATAL1("Interrupt message failure. Wrote %"Pd" bytes.", result); |
168 } | 168 } |
169 } | 169 } |
170 | 170 |
171 | 171 |
172 bool EventHandlerImplementation::GetInterruptMessage(InterruptMessage* msg) { | 172 bool EventHandlerImplementation::GetInterruptMessage(InterruptMessage* msg) { |
173 char* dst = reinterpret_cast<char*>(msg); | 173 char* dst = reinterpret_cast<char*>(msg); |
174 int total_read = 0; | 174 int total_read = 0; |
175 int bytes_read = | 175 int bytes_read = |
176 TEMP_FAILURE_RETRY(read(interrupt_fds_[0], dst, kInterruptMessageSize)); | 176 TEMP_FAILURE_RETRY(read(interrupt_fds_[0], dst, kInterruptMessageSize)); |
177 if (bytes_read < 0) { | 177 if (bytes_read < 0) { |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 void* EventHandlerImplementation::GetHashmapKeyFromFd(intptr_t fd) { | 420 void* EventHandlerImplementation::GetHashmapKeyFromFd(intptr_t fd) { |
421 // The hashmap does not support keys with value 0. | 421 // The hashmap does not support keys with value 0. |
422 return reinterpret_cast<void*>(fd + 1); | 422 return reinterpret_cast<void*>(fd + 1); |
423 } | 423 } |
424 | 424 |
425 | 425 |
426 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { | 426 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { |
427 // The hashmap does not support keys with value 0. | 427 // The hashmap does not support keys with value 0. |
428 return dart::Utils::WordHash(fd + 1); | 428 return dart::Utils::WordHash(fd + 1); |
429 } | 429 } |
OLD | NEW |