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 #if !defined(DART_IO_DISABLED) | 5 #if !defined(DART_IO_DISABLED) |
6 | 6 |
7 #include "platform/globals.h" | 7 #include "platform/globals.h" |
8 #if defined(TARGET_OS_LINUX) | 8 #if defined(TARGET_OS_LINUX) |
9 | 9 |
10 #include "bin/file_system_watcher.h" | 10 #include "bin/file_system_watcher.h" |
11 | 11 |
12 #include <errno.h> // NOLINT | 12 #include <errno.h> // NOLINT |
13 #include <sys/inotify.h> // NOLINT | 13 #include <sys/inotify.h> // NOLINT |
14 | 14 |
15 #include "bin/fdutils.h" | 15 #include "bin/fdutils.h" |
16 #include "bin/socket.h" | 16 #include "bin/socket.h" |
17 #include "platform/signal_blocker.h" | 17 #include "platform/signal_blocker.h" |
18 | 18 |
19 namespace dart { | 19 namespace dart { |
20 namespace bin { | 20 namespace bin { |
21 | 21 |
22 bool FileSystemWatcher::IsSupported() { | 22 bool FileSystemWatcher::IsSupported() { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 while (offset < bytes) { | 121 while (offset < bytes) { |
122 struct inotify_event* e = | 122 struct inotify_event* e = |
123 reinterpret_cast<struct inotify_event*>(buffer + offset); | 123 reinterpret_cast<struct inotify_event*>(buffer + offset); |
124 if ((e->mask & IN_IGNORED) == 0) { | 124 if ((e->mask & IN_IGNORED) == 0) { |
125 Dart_Handle event = Dart_NewList(5); | 125 Dart_Handle event = Dart_NewList(5); |
126 int mask = InotifyEventToMask(e); | 126 int mask = InotifyEventToMask(e); |
127 Dart_ListSetAt(event, 0, Dart_NewInteger(mask)); | 127 Dart_ListSetAt(event, 0, Dart_NewInteger(mask)); |
128 Dart_ListSetAt(event, 1, Dart_NewInteger(e->cookie)); | 128 Dart_ListSetAt(event, 1, Dart_NewInteger(e->cookie)); |
129 if (e->len > 0) { | 129 if (e->len > 0) { |
130 Dart_ListSetAt(event, 2, Dart_NewStringFromUTF8( | 130 Dart_ListSetAt(event, 2, Dart_NewStringFromUTF8( |
131 reinterpret_cast<uint8_t*>(e->name), strlen(e->name))); | 131 reinterpret_cast<uint8_t*>(e->name), |
| 132 strlen(e->name))); |
132 } else { | 133 } else { |
133 Dart_ListSetAt(event, 2, Dart_Null()); | 134 Dart_ListSetAt(event, 2, Dart_Null()); |
134 } | 135 } |
135 Dart_ListSetAt(event, 3, Dart_NewBoolean(e->mask & IN_MOVED_TO)); | 136 Dart_ListSetAt(event, 3, Dart_NewBoolean(e->mask & IN_MOVED_TO)); |
136 Dart_ListSetAt(event, 4, Dart_NewInteger(e->wd)); | 137 Dart_ListSetAt(event, 4, Dart_NewInteger(e->wd)); |
137 Dart_ListSetAt(events, i, event); | 138 Dart_ListSetAt(events, i, event); |
138 i++; | 139 i++; |
139 } | 140 } |
140 offset += kEventSize + e->len; | 141 offset += kEventSize + e->len; |
141 } | 142 } |
142 ASSERT(offset == bytes); | 143 ASSERT(offset == bytes); |
143 return events; | 144 return events; |
144 } | 145 } |
145 | 146 |
146 } // namespace bin | 147 } // namespace bin |
147 } // namespace dart | 148 } // namespace dart |
148 | 149 |
149 #endif // defined(TARGET_OS_LINUX) | 150 #endif // defined(TARGET_OS_LINUX) |
150 | 151 |
151 #endif // !defined(DART_IO_DISABLED) | 152 #endif // !defined(DART_IO_DISABLED) |
OLD | NEW |