From: Jan Korous Date: Mon, 15 Jul 2019 23:14:00 +0000 (+0000) Subject: [DirectoryWatcher][linux] Fix for older kernels X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4dd2aac2fd8c1e7caf676f075cf4edf7dc67921b;p=clang [DirectoryWatcher][linux] Fix for older kernels IN_EXCL_UNLINK exists since Linux 2.6.36 Differential Revision: https://reviews.llvm.org/D64764 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@366152 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp b/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp index 0c9f799b63..6d7d69da4d 100644 --- a/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp +++ b/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -332,8 +333,12 @@ std::unique_ptr 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;