diff options
author | Jan Korous <jkorous@apple.com> | 2019-07-15 23:14:00 +0000 |
---|---|---|
committer | Jan Korous <jkorous@apple.com> | 2019-07-15 23:14:00 +0000 |
commit | 60a0d49e77cf6583b749ad6189751cd5d31bf3ee (patch) | |
tree | 76448cafa90da79a0f9cb647c2833274bcce29e0 /clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp | |
parent | 51193871dafd99e79d7d19f62cffbdcdda238530 (diff) | |
download | bcm5719-llvm-60a0d49e77cf6583b749ad6189751cd5d31bf3ee.tar.gz bcm5719-llvm-60a0d49e77cf6583b749ad6189751cd5d31bf3ee.zip |
[DirectoryWatcher][linux] Fix for older kernels
IN_EXCL_UNLINK exists since Linux 2.6.36
Differential Revision: https://reviews.llvm.org/D64764
llvm-svn: 366152
Diffstat (limited to 'clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp')
-rw-r--r-- | clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp b/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp index 0c9f799b638..6d7d69da4db 100644 --- a/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp +++ b/clang/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 @@ std::unique_ptr<DirectoryWatcher> clang::DirectoryWatcher::create( 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; |