r366152 - [DirectoryWatcher][linux] Fix for older kernels
Jan Korous via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 15 16:14:00 PDT 2019
Author: jkorous
Date: Mon Jul 15 16:14:00 2019
New Revision: 366152
URL: http://llvm.org/viewvc/llvm-project?rev=366152&view=rev
Log:
[DirectoryWatcher][linux] Fix for older kernels
IN_EXCL_UNLINK exists since Linux 2.6.36
Differential Revision: https://reviews.llvm.org/D64764
Modified:
cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
Modified: cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp?rev=366152&r1=366151&r2=366152&view=diff
==============================================================================
--- cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp (original)
+++ cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp Mon Jul 15 16:14:00 2019
@@ -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 @@ std::unique_ptr<DirectoryWatcher> clang:
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;
More information about the cfe-commits
mailing list