Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Unified Diff: runtime/bin/file_system_watcher_linux.cc

Issue 48493003: Make FileSystemWatcher work on MIPS and make watching on android the same as linux. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/bin/file_system_watcher_linux.cc
diff --git a/runtime/bin/file_system_watcher_linux.cc b/runtime/bin/file_system_watcher_linux.cc
index b8aeab47ab5285a191c661379fa645bc56cf400b..4e574463f1b2bb0bc3fc81e6de357118bd5e2275 100644
--- a/runtime/bin/file_system_watcher_linux.cc
+++ b/runtime/bin/file_system_watcher_linux.cc
@@ -10,6 +10,8 @@
#include <errno.h> // NOLINT
#include <sys/inotify.h> // NOLINT
+#include "bin/fdutils.h"
+
namespace dart {
namespace bin {
@@ -22,8 +24,12 @@ bool FileSystemWatcher::IsSupported() {
intptr_t FileSystemWatcher::WatchPath(const char* path,
int events,
bool recursive) {
- int fd = TEMP_FAILURE_RETRY(inotify_init1(IN_NONBLOCK | IN_CLOEXEC));
+ int fd = TEMP_FAILURE_RETRY(inotify_init1(IN_CLOEXEC));
if (fd < 0) return -1;
+ // Some systems dosn't support setting this as non-blocking. Since watching
+ // internals are kept away from the user, we know it's possible to continue,
+ // even if setting non-blocking fails.
+ FDUtils::SetNonBlocking(fd);
int list_events = IN_DELETE_SELF | IN_MOVE_SELF;
if (events & kCreate) list_events |= IN_CREATE;
if (events & kModifyContent) list_events |= IN_CLOSE_WRITE | IN_ATTRIB;
« runtime/bin/file_system_watcher_android.cc ('K') | « runtime/bin/file_system_watcher_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698