diff --git base/files/file_path_watcher_linux.cc base/files/file_path_watcher_linux.cc index 22732f2864ef..7d5caef5c3b0 100644 --- base/files/file_path_watcher_linux.cc +++ base/files/file_path_watcher_linux.cc @@ -5,6 +5,7 @@ #include "base/files/file_path_watcher.h" #include +#include #include #include #include @@ -13,6 +14,7 @@ #include #include +#include #include #include #include @@ -220,22 +222,15 @@ void InotifyReaderThreadDelegate::ThreadMain() { PlatformThread::SetName("inotify_reader"); // Make sure the file descriptors are good for use with select(). - CHECK_LE(0, inotify_fd_); - CHECK_GT(FD_SETSIZE, inotify_fd_); + std::array fdarray + { { + { inotify_fd_, POLLIN, 0 } + } }; while (true) { - fd_set rfds; - FD_ZERO(&rfds); - FD_SET(inotify_fd_, &rfds); - - ScopedBlockingCall scoped_blocking_call(FROM_HERE, - BlockingType::WILL_BLOCK); - - // Wait until some inotify events are available. - int select_result = - HANDLE_EINTR(select(inotify_fd_ + 1, &rfds, nullptr, nullptr, nullptr)); - if (select_result < 0) { - DPLOG(WARNING) << "select failed"; + int poll_result = HANDLE_EINTR(poll(fdarray.data(), fdarray.size(), -1)); + if (poll_result < 0) { + DPLOG(WARNING) << "poll failed"; return; }