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_LINUX) | 6 #if defined(TARGET_OS_LINUX) |
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 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 struct inotify_event* e = | 64 struct inotify_event* e = |
65 reinterpret_cast<struct inotify_event*>(buffer + offset); | 65 reinterpret_cast<struct inotify_event*>(buffer + offset); |
66 Dart_Handle event = Dart_NewList(4); | 66 Dart_Handle event = Dart_NewList(4); |
67 int mask = 0; | 67 int mask = 0; |
68 if (e->mask & IN_MODIFY) mask |= kModifyContent; | 68 if (e->mask & IN_MODIFY) mask |= kModifyContent; |
69 if (e->mask & IN_ATTRIB) mask |= kModefyAttribute; | 69 if (e->mask & IN_ATTRIB) mask |= kModefyAttribute; |
70 if (e->mask & IN_CREATE) mask |= kCreate; | 70 if (e->mask & IN_CREATE) mask |= kCreate; |
71 if (e->mask & IN_MOVE) mask |= kMove; | 71 if (e->mask & IN_MOVE) mask |= kMove; |
72 if (e->mask & IN_DELETE) mask |= kDelete; | 72 if (e->mask & IN_DELETE) mask |= kDelete; |
73 if (e->mask & IN_DELETE_SELF) mask |= kDeleteSelf; | 73 if (e->mask & IN_DELETE_SELF) mask |= kDeleteSelf; |
| 74 if (e->mask & IN_ISDIR) mask |= kIsDir; |
74 Dart_ListSetAt(event, 0, Dart_NewInteger(mask)); | 75 Dart_ListSetAt(event, 0, Dart_NewInteger(mask)); |
75 Dart_ListSetAt(event, 1, Dart_NewInteger(e->cookie)); | 76 Dart_ListSetAt(event, 1, Dart_NewInteger(e->cookie)); |
76 if (e->len > 0) { | 77 if (e->len > 0) { |
77 Dart_ListSetAt(event, 2, Dart_NewStringFromUTF8( | 78 Dart_ListSetAt(event, 2, Dart_NewStringFromUTF8( |
78 reinterpret_cast<uint8_t*>(e->name), strlen(e->name))); | 79 reinterpret_cast<uint8_t*>(e->name), strlen(e->name))); |
79 } else { | 80 } else { |
80 Dart_ListSetAt(event, 2, Dart_Null()); | 81 Dart_ListSetAt(event, 2, Dart_Null()); |
81 } | 82 } |
82 Dart_ListSetAt(event, 3, Dart_NewBoolean(e->mask & IN_MOVED_TO)); | 83 Dart_ListSetAt(event, 3, Dart_NewBoolean(e->mask & IN_MOVED_TO)); |
83 Dart_ListSetAt(events, i, event); | 84 Dart_ListSetAt(events, i, event); |
84 i++; | 85 i++; |
85 offset += kEventSize + e->len; | 86 offset += kEventSize + e->len; |
86 } | 87 } |
87 ASSERT(offset == bytes); | 88 ASSERT(offset == bytes); |
88 return events; | 89 return events; |
89 } | 90 } |
90 | 91 |
91 } // namespace bin | 92 } // namespace bin |
92 } // namespace dart | 93 } // namespace dart |
93 | 94 |
94 #endif // defined(TARGET_OS_LINUX) | 95 #endif // defined(TARGET_OS_LINUX) |
95 | 96 |
OLD | NEW |