From 24cff0ec31970d5d57f61ba99ba7bfdda725cf94 Mon Sep 17 00:00:00 2001 From: Albert Cervin Date: Sun, 7 May 2023 23:59:22 +0200 Subject: Implement file reloading When for examplue using formatters or doing vc updates, it is useful if the file is reloaded from disk. --- src/dged/reactor.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/dged/reactor.h') diff --git a/src/dged/reactor.h b/src/dged/reactor.h index e54afda..1fa014d 100644 --- a/src/dged/reactor.h +++ b/src/dged/reactor.h @@ -6,6 +6,16 @@ enum interest { WriteInterest = 2, }; +enum file_event_type { + FileWritten = 1 << 0, + LastEvent = 1 << 1, +}; + +struct file_event { + uint32_t mask; + uint32_t id; +}; + struct reactor; struct reactor *reactor_create(); @@ -14,4 +24,7 @@ void reactor_update(struct reactor *reactor); bool reactor_poll_event(struct reactor *reactor, uint32_t ev_id); uint32_t reactor_register_interest(struct reactor *reactor, int fd, enum interest interest); +uint32_t reactor_watch_file(struct reactor *reactor, const char *path, uint32_t mask); +void reactor_unwatch_file(struct reactor *reactor, uint32_t id); +bool reactor_next_file_event(struct reactor *reactor, struct file_event *out); void reactor_unregister_interest(struct reactor *reactor, uint32_t ev_id); -- cgit v1.2.3