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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // If stdout, redirect fd to /dev/null. | 226 // If stdout, redirect fd to /dev/null. |
227 int null_fd = TEMP_FAILURE_RETRY(open("/dev/null", O_WRONLY)); | 227 int null_fd = TEMP_FAILURE_RETRY(open("/dev/null", O_WRONLY)); |
228 ASSERT(null_fd >= 0); | 228 ASSERT(null_fd >= 0); |
229 VOID_TEMP_FAILURE_RETRY(dup2(null_fd, STDOUT_FILENO)); | 229 VOID_TEMP_FAILURE_RETRY(dup2(null_fd, STDOUT_FILENO)); |
230 VOID_TEMP_FAILURE_RETRY(close(null_fd)); | 230 VOID_TEMP_FAILURE_RETRY(close(null_fd)); |
231 } else { | 231 } else { |
232 sd->Close(); | 232 sd->Close(); |
233 } | 233 } |
234 socket_map_.Remove(GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd)); | 234 socket_map_.Remove(GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd)); |
235 delete sd; | 235 delete sd; |
| 236 DartUtils::PostInt32(msg.dart_port, 1 << kDestroyedEvent); |
236 } else { | 237 } else { |
237 if ((msg.data & (1 << kInEvent)) != 0 && sd->IsClosedRead()) { | 238 if ((msg.data & (1 << kInEvent)) != 0 && sd->IsClosedRead()) { |
238 DartUtils::PostInt32(msg.dart_port, 1 << kCloseEvent); | 239 DartUtils::PostInt32(msg.dart_port, 1 << kCloseEvent); |
239 } else { | 240 } else { |
240 // Setup events to wait for. | 241 // Setup events to wait for. |
241 sd->SetPortAndMask(msg.dart_port, msg.data); | 242 sd->SetPortAndMask(msg.dart_port, msg.data); |
242 UpdateEpollInstance(epoll_fd_, sd); | 243 UpdateEpollInstance(epoll_fd_, sd); |
243 } | 244 } |
244 } | 245 } |
245 } | 246 } |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 | 443 |
443 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { | 444 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { |
444 // The hashmap does not support keys with value 0. | 445 // The hashmap does not support keys with value 0. |
445 return dart::Utils::WordHash(fd + 1); | 446 return dart::Utils::WordHash(fd + 1); |
446 } | 447 } |
447 | 448 |
448 } // namespace bin | 449 } // namespace bin |
449 } // namespace dart | 450 } // namespace dart |
450 | 451 |
451 #endif // defined(TARGET_OS_LINUX) | 452 #endif // defined(TARGET_OS_LINUX) |
OLD | NEW |