| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_ANDROID) | 6 #if defined(TARGET_OS_ANDROID) |
| 7 | 7 |
| 8 #include "bin/file_system_watcher.h" | 8 #include "bin/file_system_watcher.h" |
| 9 | 9 |
| 10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
| 11 #include <sys/inotify.h> // NOLINT | 11 #include <sys/inotify.h> // NOLINT |
| 12 | 12 |
| 13 | 13 |
| 14 namespace dart { | 14 namespace dart { |
| 15 namespace bin { | 15 namespace bin { |
| 16 | 16 |
| 17 bool FileSystemWatcher::IsSupported() { |
| 18 return true; |
| 19 } |
| 20 |
| 21 |
| 17 intptr_t FileSystemWatcher::WatchPath(const char* path, | 22 intptr_t FileSystemWatcher::WatchPath(const char* path, |
| 18 int events, | 23 int events, |
| 19 bool recursive) { | 24 bool recursive) { |
| 20 int fd = TEMP_FAILURE_RETRY(inotify_init1(IN_NONBLOCK | IN_CLOEXEC)); | 25 int fd = TEMP_FAILURE_RETRY(inotify_init1(IN_NONBLOCK | IN_CLOEXEC)); |
| 21 if (fd < 0) return -1; | 26 if (fd < 0) return -1; |
| 22 int list_events = 0; | 27 int list_events = 0; |
| 23 if (events & kCreate) list_events |= IN_CREATE; | 28 if (events & kCreate) list_events |= IN_CREATE; |
| 24 if (events & kModifyContent) list_events |= IN_MODIFY | IN_ATTRIB; | 29 if (events & kModifyContent) list_events |= IN_MODIFY | IN_ATTRIB; |
| 25 if (events & kDelete) list_events |= IN_DELETE; | 30 if (events & kDelete) list_events |= IN_DELETE; |
| 26 if (events & kMove) list_events |= IN_MOVE; | 31 if (events & kMove) list_events |= IN_MOVE; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } | 84 } |
| 80 ASSERT(offset == bytes); | 85 ASSERT(offset == bytes); |
| 81 return events; | 86 return events; |
| 82 } | 87 } |
| 83 | 88 |
| 84 } // namespace bin | 89 } // namespace bin |
| 85 } // namespace dart | 90 } // namespace dart |
| 86 | 91 |
| 87 #endif // defined(TARGET_OS_ANDROID) | 92 #endif // defined(TARGET_OS_ANDROID) |
| 88 | 93 |
| OLD | NEW |