6#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_ANDROID)
11#include <sys/inotify.h>
46 int list_events = IN_DELETE_SELF | IN_MOVE_SELF;
48 list_events |= IN_CREATE;
51 list_events |= IN_CLOSE_WRITE | IN_ATTRIB | IN_MODIFY;
54 list_events |= IN_DELETE;
56 if ((events &
kMove) != 0) {
57 list_events |= IN_MOVE;
60 path = resolved_path !=
nullptr ? resolved_path :
path;
77static int InotifyEventToMask(
struct inotify_event* e) {
79 if ((
e->mask & IN_CLOSE_WRITE) != 0 || (
e->mask & IN_MODIFY) != 0) {
82 if ((
e->mask & IN_ATTRIB) != 0) {
85 if ((
e->mask & IN_CREATE) != 0) {
88 if ((
e->mask & IN_MOVE) != 0) {
91 if ((
e->mask & IN_DELETE) != 0) {
94 if ((
e->mask & (IN_DELETE_SELF | IN_MOVE_SELF)) != 0) {
97 if ((
e->mask & IN_ISDIR) != 0) {
105 const intptr_t kEventSize =
sizeof(
struct inotify_event);
106 const intptr_t
kBufferSize = kEventSize + NAME_MAX + 1;
113 const intptr_t kMaxCount = bytes / kEventSize;
118 struct inotify_event*
e =
119 reinterpret_cast<struct inotify_event*
>(
buffer +
offset);
120 if ((
e->mask & IN_IGNORED) == 0) {
122 int mask = InotifyEventToMask(e);
127 reinterpret_cast<uint8_t*
>(
e->name), strlen(
e->name));
static const size_t kBufferSize
static Dart_Handle NewDartOSError()
static bool SetNonBlocking(intptr_t fd)
static intptr_t GetSocketId(intptr_t id, intptr_t path_id)
static void Close(intptr_t id)
static void UnwatchPath(intptr_t id, intptr_t path_id)
static bool IsSupported()
static Dart_Handle ReadEvents(intptr_t id, intptr_t path_id)
static intptr_t WatchPath(intptr_t id, Namespace *namespc, const char *path, int events, bool recursive)
static const char * GetCanonicalPath(Namespace *namespc, const char *path, char *dest=nullptr, int dest_size=0)
static intptr_t Read(intptr_t fd, void *buffer, intptr_t num_bytes, SocketOpKind sync)
struct _Dart_Handle * Dart_Handle
static const uint8_t buffer[]
DART_EXPORT Dart_Handle Dart_NewInteger(int64_t value)
DART_EXPORT Dart_Handle Dart_NewStringFromUTF8(const uint8_t *utf8_array, intptr_t length)
DART_EXPORT Dart_Handle Dart_ListSetAt(Dart_Handle list, intptr_t index, Dart_Handle value)
DART_EXPORT Dart_Handle Dart_NewBoolean(bool value)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
DART_EXPORT Dart_Handle Dart_NewList(intptr_t length)
DART_EXPORT Dart_Handle Dart_Null()
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
#define NO_RETRY_EXPECTED(expression)
#define VOID_NO_RETRY_EXPECTED(expression)