[DirectoryWatcher][linux] Fix build for older kernels
authorJan Korous <jkorous@apple.com>
Mon, 5 Aug 2019 18:44:07 +0000 (18:44 +0000)
committerJan Korous <jkorous@apple.com>
Mon, 5 Aug 2019 18:44:07 +0000 (18:44 +0000)
Apparently kernel support for IN_EXCL_UNLINK in inotify_add_watch() doesn't imply it's defined in sys/inotify.h.

https://bugs.llvm.org/show_bug.cgi?id=42824

llvm-svn: 367906

clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp

index 28af84e..6998efb 100644 (file)
@@ -24,7 +24,6 @@
 #include <vector>
 
 #include <fcntl.h>
-#include <linux/version.h>
 #include <sys/epoll.h>
 #include <sys/inotify.h>
 #include <unistd.h>
@@ -336,7 +335,7 @@ std::unique_ptr<DirectoryWatcher> clang::DirectoryWatcher::create(
       InotifyFD, Path.str().c_str(),
       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)
+#ifdef IN_EXCL_UNLINK
       | IN_EXCL_UNLINK
 #endif
       );