[PATCH] D64764: [DirectoryWatcher][linux] Fix build for older kernels

Jan Korous via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 15 16:13:48 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL366152: [DirectoryWatcher][linux] Fix for older kernels (authored by jkorous, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64764?vs=209919&id=209988#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64764/new/

https://reviews.llvm.org/D64764

Files:
  cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp


Index: cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
===================================================================
--- cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
+++ cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
@@ -24,6 +24,7 @@
 #include <vector>
 
 #include <fcntl.h>
+#include <linux/version.h>
 #include <sys/epoll.h>
 #include <sys/inotify.h>
 #include <unistd.h>
@@ -332,8 +333,12 @@
 
   const int InotifyWD = inotify_add_watch(
       InotifyFD, Path.str().c_str(),
-      IN_CREATE | IN_DELETE | IN_DELETE_SELF | IN_EXCL_UNLINK | IN_MODIFY |
-          IN_MOVED_FROM | IN_MOVE_SELF | IN_MOVED_TO | IN_ONLYDIR | IN_IGNORED);
+      IN_CREATE | IN_DELETE | IN_DELETE_SELF | IN_MODIFY |
+      IN_MOVED_FROM | IN_MOVE_SELF | IN_MOVED_TO | IN_ONLYDIR | IN_IGNORED
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
+      | IN_EXCL_UNLINK
+#endif
+      );
   if (InotifyWD == -1)
     return nullptr;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64764.209988.patch
Type: text/x-patch
Size: 972 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190715/77822acb/attachment.bin>


More information about the llvm-commits mailing list