X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Ffs%2Funix%2Ffilemonitor_platform.h;fp=source%2Ffs%2Funix%2Ffilemonitor_platform.h;h=31b728ffd81b5ff56219aaf7ca8849b3aed34c9c;hp=0000000000000000000000000000000000000000;hb=ffab0509a65f6f32851e64d66a5f7eeb453ab29f;hpb=c7b4b9d6e07b3e32e5b03f41f0640a8273eed848 diff --git a/source/fs/unix/filemonitor_platform.h b/source/fs/unix/filemonitor_platform.h new file mode 100644 index 0000000..31b728f --- /dev/null +++ b/source/fs/unix/filemonitor_platform.h @@ -0,0 +1,45 @@ +#ifndef MSP_FS_FILEMONITOR_PLATFORM_H_ +#define MSP_FS_FILEMONITOR_PLATFORM_H_ + +namespace Msp { +namespace FS { + +class INotify: public IO::EventObject +{ +private: + IO::Handle fd; + +public: + INotify(); + ~INotify(); + + int add_watch(const FS::Path &, int); + void remove_watch(int); + + virtual void set_block(bool) { } + virtual void set_inherit(bool) { } + +protected: + virtual unsigned do_write(const char *, unsigned); + virtual unsigned do_read(char *, unsigned); + +public: + virtual const IO::Handle &get_handle(IO::Mode) { return fd; } + virtual const IO::Handle &get_event_handle() { return fd; } +}; + + +struct FileMonitor::Private +{ + FileMonitor &monitor; + INotify inotify; + + Private(FileMonitor &); + + void events_available(); +}; + +} // namespace FS +} // namespace Msp + +#endif