21#ifndef FSW_FANOTIFY_MONITOR_H
22# define FSW_FANOTIFY_MONITOR_H
29# include <sys/types.h>
44 static constexpr const char *PROCESS_ID_PROPERTY =
"fanotify.process-id";
45 static constexpr const char *REPORT_PIDFD_PROPERTY =
"fanotify.report-pidfd";
46 static constexpr const char *UNLIMITED_QUEUE_PROPERTY =
"fanotify.unlimited-queue";
47 static constexpr const char *UNLIMITED_MARKS_PROPERTY =
"fanotify.unlimited-marks";
49 fanotify_monitor(std::vector<std::string>
paths,
53 ~fanotify_monitor()
override;
60 fanotify_monitor(
const fanotify_monitor& orig) =
delete;
61 fanotify_monitor& operator=(
const fanotify_monitor& that) =
delete;
64 void scan_root_paths();
65 void scan(
const std::filesystem::path& path,
bool accept_non_dirs =
true);
66 bool add_mark(
const std::filesystem::path& path);
67 bool is_watched(
const std::string& path)
const;
68 void process_pending_paths();
69 void process_synthetic_events();
70 void process_events(
char *buffer, ssize_t length);
71 void notify_and_clear_events();
73 std::unique_ptr<fanotify_monitor_impl> impl;
void run() override
Execute monitor loop.
Definition fanotify_monitor.cpp:632
void on_stop() override
Execute an implementation-specific stop handler.
Definition fanotify_monitor.cpp:614
std::vector< std::string > paths
List of paths to watch.
Definition monitor.hpp:527
void * context
Pointer to context data that will be passed to the monitor::callback.
Definition monitor.hpp:547
FSW_EVENT_CALLBACK * callback
Callback to which change events should be notified.
Definition monitor.hpp:542
monitor(std::vector< std::string > paths, FSW_EVENT_CALLBACK *callback, void *context=nullptr)
Constructs a monitor watching the specified paths.
Definition monitor.cpp:50
Header of the fsw::monitor class.
Main namespace of libfswatch.
Definition event.cpp:24
void FSW_EVENT_CALLBACK(const std::vector< event > &, void *)
Function definition of an event callback.
Definition monitor.hpp:57
Definition fanotify_monitor.cpp:240