| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 InterruptMessage msg; | 169 InterruptMessage msg; |
| 170 msg.id = id; | 170 msg.id = id; |
| 171 msg.dart_port = dart_port; | 171 msg.dart_port = dart_port; |
| 172 msg.data = data; | 172 msg.data = data; |
| 173 intptr_t result = | 173 intptr_t result = |
| 174 FDUtils::WriteToBlocking(interrupt_fds_[1], &msg, kInterruptMessageSize); | 174 FDUtils::WriteToBlocking(interrupt_fds_[1], &msg, kInterruptMessageSize); |
| 175 if (result != kInterruptMessageSize) { | 175 if (result != kInterruptMessageSize) { |
| 176 if (result == -1) { | 176 if (result == -1) { |
| 177 perror("Interrupt message failure:"); | 177 perror("Interrupt message failure:"); |
| 178 } | 178 } |
| 179 FATAL1("Interrupt message failure. Wrote %d bytes.", result); | 179 FATAL1("Interrupt message failure. Wrote %"Pd" bytes.", result); |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 | 182 |
| 183 | 183 |
| 184 bool EventHandlerImplementation::GetInterruptMessage(InterruptMessage* msg) { | 184 bool EventHandlerImplementation::GetInterruptMessage(InterruptMessage* msg) { |
| 185 char* dst = reinterpret_cast<char*>(msg); | 185 char* dst = reinterpret_cast<char*>(msg); |
| 186 int total_read = 0; | 186 int total_read = 0; |
| 187 int bytes_read = | 187 int bytes_read = |
| 188 TEMP_FAILURE_RETRY(read(interrupt_fds_[0], dst, kInterruptMessageSize)); | 188 TEMP_FAILURE_RETRY(read(interrupt_fds_[0], dst, kInterruptMessageSize)); |
| 189 if (bytes_read < 0) { | 189 if (bytes_read < 0) { |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 void* EventHandlerImplementation::GetHashmapKeyFromFd(intptr_t fd) { | 413 void* EventHandlerImplementation::GetHashmapKeyFromFd(intptr_t fd) { |
| 414 // The hashmap does not support keys with value 0. | 414 // The hashmap does not support keys with value 0. |
| 415 return reinterpret_cast<void*>(fd + 1); | 415 return reinterpret_cast<void*>(fd + 1); |
| 416 } | 416 } |
| 417 | 417 |
| 418 | 418 |
| 419 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { | 419 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { |
| 420 // The hashmap does not support keys with value 0. | 420 // The hashmap does not support keys with value 0. |
| 421 return dart::Utils::WordHash(fd + 1); | 421 return dart::Utils::WordHash(fd + 1); |
| 422 } | 422 } |
| OLD | NEW |