6#if defined(__linux__
) || defined(DOXYGEN)
8#include <sys/inotify.h>
13#include <unordered_map>
15#include <userver/engine/io/fd_poller.hpp>
16#include <userver/logging/fwd.hpp>
17#include <userver/utils/flags.hpp>
19USERVER_NAMESPACE_BEGIN
21namespace engine::
io::sys_linux {
27 kAttribChanged = IN_ATTRIB,
28 kCloseWrite = IN_CLOSE_WRITE,
29 kCloseNoWrite = IN_CLOSE_NOWRITE,
32 kDeleteSelf = IN_DELETE_SELF,
34 kMoveSelf = IN_MOVE_SELF,
35 kMovedFrom = IN_MOVED_FROM,
36 kMovedTo = IN_MOVED_TO,
40 kOnlyDir = IN_ONLYDIR,
48std::string ToString(EventTypeMask);
55 bool operator==(
const Event& other)
const {
return path == other.path && mask == other.mask; }
66 Inotify(
const Inotify&) =
delete;
68 Inotify(Inotify&&) =
delete;
72 Inotify& operator=(Inotify&&) =
delete;
74 Inotify& operator=(
const Inotify&) =
delete;
78 void AddWatch(
const std::string& path, EventTypeMask flags);
86 std::optional<
Event>
Poll(engine::Deadline deadline);
92 std::queue<Event> pending_events_;
93 std::unordered_map<std::string,
int> path_to_wd_;
94 std::unordered_map<
int, std::string> wd_to_path_;