xref: /openbsd-src/gnu/llvm/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp (revision 12c855180aad702bbcca06e0398d774beeafb155)
1e5dd7070Spatrick //===- DirectoryWatcher-linux.cpp - Linux-platform directory watching -----===//
2e5dd7070Spatrick //
3e5dd7070Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4e5dd7070Spatrick // See https://llvm.org/LICENSE.txt for license information.
5e5dd7070Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6e5dd7070Spatrick //
7e5dd7070Spatrick //===----------------------------------------------------------------------===//
8e5dd7070Spatrick 
9e5dd7070Spatrick #include "DirectoryScanner.h"
10e5dd7070Spatrick #include "clang/DirectoryWatcher/DirectoryWatcher.h"
11e5dd7070Spatrick 
12e5dd7070Spatrick #include "llvm/ADT/STLExtras.h"
13e5dd7070Spatrick #include "llvm/ADT/ScopeExit.h"
14e5dd7070Spatrick #include "llvm/Support/AlignOf.h"
15e5dd7070Spatrick #include "llvm/Support/Errno.h"
16e5dd7070Spatrick #include "llvm/Support/Error.h"
17a9ac8606Spatrick #include "llvm/Support/MathExtras.h"
18e5dd7070Spatrick #include "llvm/Support/Path.h"
19e5dd7070Spatrick #include <atomic>
20e5dd7070Spatrick #include <condition_variable>
21e5dd7070Spatrick #include <mutex>
22e5dd7070Spatrick #include <queue>
23e5dd7070Spatrick #include <string>
24e5dd7070Spatrick #include <thread>
25e5dd7070Spatrick #include <vector>
26e5dd7070Spatrick 
27e5dd7070Spatrick #include <fcntl.h>
28*12c85518Srobert #include <optional>
29e5dd7070Spatrick #include <sys/epoll.h>
30e5dd7070Spatrick #include <sys/inotify.h>
31e5dd7070Spatrick #include <unistd.h>
32e5dd7070Spatrick 
33e5dd7070Spatrick namespace {
34e5dd7070Spatrick 
35e5dd7070Spatrick using namespace llvm;
36e5dd7070Spatrick using namespace clang;
37e5dd7070Spatrick 
38e5dd7070Spatrick /// Pipe for inter-thread synchronization - for epoll-ing on multiple
39e5dd7070Spatrick /// conditions. It is meant for uni-directional 1:1 signalling - specifically:
40e5dd7070Spatrick /// no multiple consumers, no data passing. Thread waiting for signal should
41e5dd7070Spatrick /// poll the FDRead. Signalling thread should call signal() which writes single
42e5dd7070Spatrick /// character to FDRead.
43e5dd7070Spatrick struct SemaphorePipe {
44e5dd7070Spatrick   // Expects two file-descriptors opened as a pipe in the canonical POSIX
45e5dd7070Spatrick   // order: pipefd[0] refers to the read end of the pipe. pipefd[1] refers to
46e5dd7070Spatrick   // the write end of the pipe.
SemaphorePipe__anon7b55d0820111::SemaphorePipe47e5dd7070Spatrick   SemaphorePipe(int pipefd[2])
48e5dd7070Spatrick       : FDRead(pipefd[0]), FDWrite(pipefd[1]), OwnsFDs(true) {}
49e5dd7070Spatrick   SemaphorePipe(const SemaphorePipe &) = delete;
50e5dd7070Spatrick   void operator=(const SemaphorePipe &) = delete;
SemaphorePipe__anon7b55d0820111::SemaphorePipe51e5dd7070Spatrick   SemaphorePipe(SemaphorePipe &&other)
52e5dd7070Spatrick       : FDRead(other.FDRead), FDWrite(other.FDWrite),
53e5dd7070Spatrick         OwnsFDs(other.OwnsFDs) // Someone could have moved from the other
54e5dd7070Spatrick                                // instance before.
55e5dd7070Spatrick   {
56e5dd7070Spatrick     other.OwnsFDs = false;
57e5dd7070Spatrick   };
58e5dd7070Spatrick 
signal__anon7b55d0820111::SemaphorePipe59e5dd7070Spatrick   void signal() {
60e5dd7070Spatrick #ifndef NDEBUG
61e5dd7070Spatrick     ssize_t Result =
62e5dd7070Spatrick #endif
63e5dd7070Spatrick     llvm::sys::RetryAfterSignal(-1, write, FDWrite, "A", 1);
64e5dd7070Spatrick     assert(Result != -1);
65e5dd7070Spatrick   }
~SemaphorePipe__anon7b55d0820111::SemaphorePipe66e5dd7070Spatrick   ~SemaphorePipe() {
67e5dd7070Spatrick     if (OwnsFDs) {
68e5dd7070Spatrick       close(FDWrite);
69e5dd7070Spatrick       close(FDRead);
70e5dd7070Spatrick     }
71e5dd7070Spatrick   }
72e5dd7070Spatrick   const int FDRead;
73e5dd7070Spatrick   const int FDWrite;
74e5dd7070Spatrick   bool OwnsFDs;
75e5dd7070Spatrick 
create__anon7b55d0820111::SemaphorePipe76*12c85518Srobert   static std::optional<SemaphorePipe> create() {
77e5dd7070Spatrick     int InotifyPollingStopperFDs[2];
78e5dd7070Spatrick     if (pipe2(InotifyPollingStopperFDs, O_CLOEXEC) == -1)
79*12c85518Srobert       return std::nullopt;
80e5dd7070Spatrick     return SemaphorePipe(InotifyPollingStopperFDs);
81e5dd7070Spatrick   }
82e5dd7070Spatrick };
83e5dd7070Spatrick 
84e5dd7070Spatrick /// Mutex-protected queue of Events.
85e5dd7070Spatrick class EventQueue {
86e5dd7070Spatrick   std::mutex Mtx;
87e5dd7070Spatrick   std::condition_variable NonEmpty;
88e5dd7070Spatrick   std::queue<DirectoryWatcher::Event> Events;
89e5dd7070Spatrick 
90e5dd7070Spatrick public:
push_back(const DirectoryWatcher::Event::EventKind K,StringRef Filename)91e5dd7070Spatrick   void push_back(const DirectoryWatcher::Event::EventKind K,
92e5dd7070Spatrick                  StringRef Filename) {
93e5dd7070Spatrick     {
94e5dd7070Spatrick       std::unique_lock<std::mutex> L(Mtx);
95e5dd7070Spatrick       Events.emplace(K, Filename);
96e5dd7070Spatrick     }
97e5dd7070Spatrick     NonEmpty.notify_one();
98e5dd7070Spatrick   }
99e5dd7070Spatrick 
100e5dd7070Spatrick   // Blocks on caller thread and uses codition_variable to wait until there's an
101e5dd7070Spatrick   // event to return.
pop_front_blocking()102e5dd7070Spatrick   DirectoryWatcher::Event pop_front_blocking() {
103e5dd7070Spatrick     std::unique_lock<std::mutex> L(Mtx);
104e5dd7070Spatrick     while (true) {
105e5dd7070Spatrick       // Since we might have missed all the prior notifications on NonEmpty we
106e5dd7070Spatrick       // have to check the queue first (under lock).
107e5dd7070Spatrick       if (!Events.empty()) {
108e5dd7070Spatrick         DirectoryWatcher::Event Front = Events.front();
109e5dd7070Spatrick         Events.pop();
110e5dd7070Spatrick         return Front;
111e5dd7070Spatrick       }
112e5dd7070Spatrick       NonEmpty.wait(L, [this]() { return !Events.empty(); });
113e5dd7070Spatrick     }
114e5dd7070Spatrick   }
115e5dd7070Spatrick };
116e5dd7070Spatrick 
117e5dd7070Spatrick class DirectoryWatcherLinux : public clang::DirectoryWatcher {
118e5dd7070Spatrick public:
119e5dd7070Spatrick   DirectoryWatcherLinux(
120e5dd7070Spatrick       llvm::StringRef WatchedDirPath,
121e5dd7070Spatrick       std::function<void(llvm::ArrayRef<Event>, bool)> Receiver,
122e5dd7070Spatrick       bool WaitForInitialSync, int InotifyFD, int InotifyWD,
123e5dd7070Spatrick       SemaphorePipe &&InotifyPollingStopSignal);
124e5dd7070Spatrick 
~DirectoryWatcherLinux()125e5dd7070Spatrick   ~DirectoryWatcherLinux() override {
126e5dd7070Spatrick     StopWork();
127e5dd7070Spatrick     InotifyPollingThread.join();
128e5dd7070Spatrick     EventsReceivingThread.join();
129e5dd7070Spatrick     inotify_rm_watch(InotifyFD, InotifyWD);
130e5dd7070Spatrick     llvm::sys::RetryAfterSignal(-1, close, InotifyFD);
131e5dd7070Spatrick   }
132e5dd7070Spatrick 
133e5dd7070Spatrick private:
134e5dd7070Spatrick   const std::string WatchedDirPath;
135e5dd7070Spatrick   // inotify file descriptor
136e5dd7070Spatrick   int InotifyFD = -1;
137e5dd7070Spatrick   // inotify watch descriptor
138e5dd7070Spatrick   int InotifyWD = -1;
139e5dd7070Spatrick 
140e5dd7070Spatrick   EventQueue Queue;
141e5dd7070Spatrick 
142e5dd7070Spatrick   // Make sure lifetime of Receiver fully contains lifetime of
143e5dd7070Spatrick   // EventsReceivingThread.
144e5dd7070Spatrick   std::function<void(llvm::ArrayRef<Event>, bool)> Receiver;
145e5dd7070Spatrick 
146e5dd7070Spatrick   // Consumes inotify events and pushes directory watcher events to the Queue.
147e5dd7070Spatrick   void InotifyPollingLoop();
148e5dd7070Spatrick   std::thread InotifyPollingThread;
149e5dd7070Spatrick   // Using pipe so we can epoll two file descriptors at once - inotify and
150e5dd7070Spatrick   // stopping condition.
151e5dd7070Spatrick   SemaphorePipe InotifyPollingStopSignal;
152e5dd7070Spatrick 
153e5dd7070Spatrick   // Does the initial scan of the directory - directly calling Receiver,
154e5dd7070Spatrick   // bypassing the Queue. Both InitialScan and EventReceivingLoop use Receiver
155e5dd7070Spatrick   // which isn't necessarily thread-safe.
156e5dd7070Spatrick   void InitialScan();
157e5dd7070Spatrick 
158e5dd7070Spatrick   // Processing events from the Queue.
159e5dd7070Spatrick   // In case client doesn't want to do the initial scan synchronously
160e5dd7070Spatrick   // (WaitForInitialSync=false in ctor) we do the initial scan at the beginning
161e5dd7070Spatrick   // of this thread.
162e5dd7070Spatrick   std::thread EventsReceivingThread;
163e5dd7070Spatrick   // Push event of WatcherGotInvalidated kind to the Queue to stop the loop.
164e5dd7070Spatrick   // Both InitialScan and EventReceivingLoop use Receiver which isn't
165e5dd7070Spatrick   // necessarily thread-safe.
166e5dd7070Spatrick   void EventReceivingLoop();
167e5dd7070Spatrick 
168e5dd7070Spatrick   // Stops all the async work. Reentrant.
StopWork()169e5dd7070Spatrick   void StopWork() {
170e5dd7070Spatrick     Queue.push_back(DirectoryWatcher::Event::EventKind::WatcherGotInvalidated,
171e5dd7070Spatrick                     "");
172e5dd7070Spatrick     InotifyPollingStopSignal.signal();
173e5dd7070Spatrick   }
174e5dd7070Spatrick };
175e5dd7070Spatrick 
InotifyPollingLoop()176e5dd7070Spatrick void DirectoryWatcherLinux::InotifyPollingLoop() {
177e5dd7070Spatrick   // We want to be able to read ~30 events at once even in the worst case
178e5dd7070Spatrick   // (obscenely long filenames).
179e5dd7070Spatrick   constexpr size_t EventBufferLength =
180e5dd7070Spatrick       30 * (sizeof(struct inotify_event) + NAME_MAX + 1);
181e5dd7070Spatrick   // http://man7.org/linux/man-pages/man7/inotify.7.html
182e5dd7070Spatrick   // Some systems cannot read integer variables if they are not
183e5dd7070Spatrick   // properly aligned. On other systems, incorrect alignment may
184e5dd7070Spatrick   // decrease performance. Hence, the buffer used for reading from
185e5dd7070Spatrick   // the inotify file descriptor should have the same alignment as
186e5dd7070Spatrick   // struct inotify_event.
187e5dd7070Spatrick 
188e5dd7070Spatrick   struct Buffer {
189e5dd7070Spatrick     alignas(struct inotify_event) char buffer[EventBufferLength];
190e5dd7070Spatrick   };
191e5dd7070Spatrick   auto ManagedBuffer = std::make_unique<Buffer>();
192e5dd7070Spatrick   char *const Buf = ManagedBuffer->buffer;
193e5dd7070Spatrick 
194e5dd7070Spatrick   const int EpollFD = epoll_create1(EPOLL_CLOEXEC);
195e5dd7070Spatrick   if (EpollFD == -1) {
196e5dd7070Spatrick     StopWork();
197e5dd7070Spatrick     return;
198e5dd7070Spatrick   }
199e5dd7070Spatrick   auto EpollFDGuard = llvm::make_scope_exit([EpollFD]() { close(EpollFD); });
200e5dd7070Spatrick 
201e5dd7070Spatrick   struct epoll_event EventSpec;
202e5dd7070Spatrick   EventSpec.events = EPOLLIN;
203e5dd7070Spatrick   EventSpec.data.fd = InotifyFD;
204e5dd7070Spatrick   if (epoll_ctl(EpollFD, EPOLL_CTL_ADD, InotifyFD, &EventSpec) == -1) {
205e5dd7070Spatrick     StopWork();
206e5dd7070Spatrick     return;
207e5dd7070Spatrick   }
208e5dd7070Spatrick 
209e5dd7070Spatrick   EventSpec.data.fd = InotifyPollingStopSignal.FDRead;
210e5dd7070Spatrick   if (epoll_ctl(EpollFD, EPOLL_CTL_ADD, InotifyPollingStopSignal.FDRead,
211e5dd7070Spatrick                 &EventSpec) == -1) {
212e5dd7070Spatrick     StopWork();
213e5dd7070Spatrick     return;
214e5dd7070Spatrick   }
215e5dd7070Spatrick 
216e5dd7070Spatrick   std::array<struct epoll_event, 2> EpollEventBuffer;
217e5dd7070Spatrick 
218e5dd7070Spatrick   while (true) {
219e5dd7070Spatrick     const int EpollWaitResult = llvm::sys::RetryAfterSignal(
220e5dd7070Spatrick         -1, epoll_wait, EpollFD, EpollEventBuffer.data(),
221e5dd7070Spatrick         EpollEventBuffer.size(), /*timeout=*/-1 /*== infinity*/);
222e5dd7070Spatrick     if (EpollWaitResult == -1) {
223e5dd7070Spatrick       StopWork();
224e5dd7070Spatrick       return;
225e5dd7070Spatrick     }
226e5dd7070Spatrick 
227e5dd7070Spatrick     // Multiple epoll_events can be received for a single file descriptor per
228e5dd7070Spatrick     // epoll_wait call.
229e5dd7070Spatrick     for (int i = 0; i < EpollWaitResult; ++i) {
230e5dd7070Spatrick       if (EpollEventBuffer[i].data.fd == InotifyPollingStopSignal.FDRead) {
231e5dd7070Spatrick         StopWork();
232e5dd7070Spatrick         return;
233e5dd7070Spatrick       }
234e5dd7070Spatrick     }
235e5dd7070Spatrick 
236e5dd7070Spatrick     // epoll_wait() always return either error or >0 events. Since there was no
237e5dd7070Spatrick     // event for stopping, it must be an inotify event ready for reading.
238e5dd7070Spatrick     ssize_t NumRead = llvm::sys::RetryAfterSignal(-1, read, InotifyFD, Buf,
239e5dd7070Spatrick                                                   EventBufferLength);
240e5dd7070Spatrick     for (char *P = Buf; P < Buf + NumRead;) {
241e5dd7070Spatrick       if (P + sizeof(struct inotify_event) > Buf + NumRead) {
242e5dd7070Spatrick         StopWork();
243e5dd7070Spatrick         llvm_unreachable("an incomplete inotify_event was read");
244e5dd7070Spatrick         return;
245e5dd7070Spatrick       }
246e5dd7070Spatrick 
247e5dd7070Spatrick       struct inotify_event *Event = reinterpret_cast<struct inotify_event *>(P);
248e5dd7070Spatrick       P += sizeof(struct inotify_event) + Event->len;
249e5dd7070Spatrick 
250e5dd7070Spatrick       if (Event->mask & (IN_CREATE | IN_MODIFY | IN_MOVED_TO | IN_DELETE) &&
251e5dd7070Spatrick           Event->len <= 0) {
252e5dd7070Spatrick         StopWork();
253e5dd7070Spatrick         llvm_unreachable("expected a filename from inotify");
254e5dd7070Spatrick         return;
255e5dd7070Spatrick       }
256e5dd7070Spatrick 
257e5dd7070Spatrick       if (Event->mask & (IN_CREATE | IN_MOVED_TO | IN_MODIFY)) {
258e5dd7070Spatrick         Queue.push_back(DirectoryWatcher::Event::EventKind::Modified,
259e5dd7070Spatrick                         Event->name);
260e5dd7070Spatrick       } else if (Event->mask & (IN_DELETE | IN_MOVED_FROM)) {
261e5dd7070Spatrick         Queue.push_back(DirectoryWatcher::Event::EventKind::Removed,
262e5dd7070Spatrick                         Event->name);
263e5dd7070Spatrick       } else if (Event->mask & (IN_DELETE_SELF | IN_MOVE_SELF)) {
264e5dd7070Spatrick         Queue.push_back(DirectoryWatcher::Event::EventKind::WatchedDirRemoved,
265e5dd7070Spatrick                         "");
266e5dd7070Spatrick         StopWork();
267e5dd7070Spatrick         return;
268e5dd7070Spatrick       } else if (Event->mask & IN_IGNORED) {
269e5dd7070Spatrick         StopWork();
270e5dd7070Spatrick         return;
271e5dd7070Spatrick       } else {
272e5dd7070Spatrick         StopWork();
273e5dd7070Spatrick         llvm_unreachable("Unknown event type.");
274e5dd7070Spatrick         return;
275e5dd7070Spatrick       }
276e5dd7070Spatrick     }
277e5dd7070Spatrick   }
278e5dd7070Spatrick }
279e5dd7070Spatrick 
InitialScan()280e5dd7070Spatrick void DirectoryWatcherLinux::InitialScan() {
281e5dd7070Spatrick   this->Receiver(getAsFileEvents(scanDirectory(WatchedDirPath)),
282e5dd7070Spatrick                  /*IsInitial=*/true);
283e5dd7070Spatrick }
284e5dd7070Spatrick 
EventReceivingLoop()285e5dd7070Spatrick void DirectoryWatcherLinux::EventReceivingLoop() {
286e5dd7070Spatrick   while (true) {
287e5dd7070Spatrick     DirectoryWatcher::Event Event = this->Queue.pop_front_blocking();
288e5dd7070Spatrick     this->Receiver(Event, false);
289e5dd7070Spatrick     if (Event.Kind ==
290e5dd7070Spatrick         DirectoryWatcher::Event::EventKind::WatcherGotInvalidated) {
291e5dd7070Spatrick       StopWork();
292e5dd7070Spatrick       return;
293e5dd7070Spatrick     }
294e5dd7070Spatrick   }
295e5dd7070Spatrick }
296e5dd7070Spatrick 
DirectoryWatcherLinux(StringRef WatchedDirPath,std::function<void (llvm::ArrayRef<Event>,bool)> Receiver,bool WaitForInitialSync,int InotifyFD,int InotifyWD,SemaphorePipe && InotifyPollingStopSignal)297e5dd7070Spatrick DirectoryWatcherLinux::DirectoryWatcherLinux(
298e5dd7070Spatrick     StringRef WatchedDirPath,
299e5dd7070Spatrick     std::function<void(llvm::ArrayRef<Event>, bool)> Receiver,
300e5dd7070Spatrick     bool WaitForInitialSync, int InotifyFD, int InotifyWD,
301e5dd7070Spatrick     SemaphorePipe &&InotifyPollingStopSignal)
302e5dd7070Spatrick     : WatchedDirPath(WatchedDirPath), InotifyFD(InotifyFD),
303e5dd7070Spatrick       InotifyWD(InotifyWD), Receiver(Receiver),
304e5dd7070Spatrick       InotifyPollingStopSignal(std::move(InotifyPollingStopSignal)) {
305e5dd7070Spatrick 
306e5dd7070Spatrick   InotifyPollingThread = std::thread([this]() { InotifyPollingLoop(); });
307e5dd7070Spatrick   // We have no guarantees about thread safety of the Receiver which is being
308e5dd7070Spatrick   // used in both InitialScan and EventReceivingLoop. We shouldn't run these
309e5dd7070Spatrick   // only synchronously.
310e5dd7070Spatrick   if (WaitForInitialSync) {
311e5dd7070Spatrick     InitialScan();
312e5dd7070Spatrick     EventsReceivingThread = std::thread([this]() { EventReceivingLoop(); });
313e5dd7070Spatrick   } else {
314e5dd7070Spatrick     EventsReceivingThread = std::thread([this]() {
315e5dd7070Spatrick       // FIXME: We might want to terminate an async initial scan early in case
316e5dd7070Spatrick       // of a failure in EventsReceivingThread.
317e5dd7070Spatrick       InitialScan();
318e5dd7070Spatrick       EventReceivingLoop();
319e5dd7070Spatrick     });
320e5dd7070Spatrick   }
321e5dd7070Spatrick }
322e5dd7070Spatrick 
323e5dd7070Spatrick } // namespace
324e5dd7070Spatrick 
create(StringRef Path,std::function<void (llvm::ArrayRef<DirectoryWatcher::Event>,bool)> Receiver,bool WaitForInitialSync)325e5dd7070Spatrick llvm::Expected<std::unique_ptr<DirectoryWatcher>> clang::DirectoryWatcher::create(
326e5dd7070Spatrick     StringRef Path,
327e5dd7070Spatrick     std::function<void(llvm::ArrayRef<DirectoryWatcher::Event>, bool)> Receiver,
328e5dd7070Spatrick     bool WaitForInitialSync) {
329e5dd7070Spatrick   if (Path.empty())
330e5dd7070Spatrick     llvm::report_fatal_error(
331e5dd7070Spatrick         "DirectoryWatcher::create can not accept an empty Path.");
332e5dd7070Spatrick 
333e5dd7070Spatrick   const int InotifyFD = inotify_init1(IN_CLOEXEC);
334e5dd7070Spatrick   if (InotifyFD == -1)
335e5dd7070Spatrick     return llvm::make_error<llvm::StringError>(
336e5dd7070Spatrick         std::string("inotify_init1() error: ") + strerror(errno),
337e5dd7070Spatrick         llvm::inconvertibleErrorCode());
338e5dd7070Spatrick 
339e5dd7070Spatrick   const int InotifyWD = inotify_add_watch(
340e5dd7070Spatrick       InotifyFD, Path.str().c_str(),
341e5dd7070Spatrick       IN_CREATE | IN_DELETE | IN_DELETE_SELF | IN_MODIFY |
342e5dd7070Spatrick       IN_MOVED_FROM | IN_MOVE_SELF | IN_MOVED_TO | IN_ONLYDIR | IN_IGNORED
343e5dd7070Spatrick #ifdef IN_EXCL_UNLINK
344e5dd7070Spatrick       | IN_EXCL_UNLINK
345e5dd7070Spatrick #endif
346e5dd7070Spatrick       );
347e5dd7070Spatrick   if (InotifyWD == -1)
348e5dd7070Spatrick     return llvm::make_error<llvm::StringError>(
349e5dd7070Spatrick         std::string("inotify_add_watch() error: ") + strerror(errno),
350e5dd7070Spatrick         llvm::inconvertibleErrorCode());
351e5dd7070Spatrick 
352e5dd7070Spatrick   auto InotifyPollingStopper = SemaphorePipe::create();
353e5dd7070Spatrick 
354e5dd7070Spatrick   if (!InotifyPollingStopper)
355e5dd7070Spatrick     return llvm::make_error<llvm::StringError>(
356e5dd7070Spatrick         std::string("SemaphorePipe::create() error: ") + strerror(errno),
357e5dd7070Spatrick         llvm::inconvertibleErrorCode());
358e5dd7070Spatrick 
359e5dd7070Spatrick   return std::make_unique<DirectoryWatcherLinux>(
360e5dd7070Spatrick       Path, Receiver, WaitForInitialSync, InotifyFD, InotifyWD,
361e5dd7070Spatrick       std::move(*InotifyPollingStopper));
362e5dd7070Spatrick }
363