diff options
| author | Albert Cervin <albert@acervin.com> | 2023-05-07 23:59:22 +0200 |
|---|---|---|
| committer | Albert Cervin <albert@acervin.com> | 2023-05-08 00:00:36 +0200 |
| commit | 24cff0ec31970d5d57f61ba99ba7bfdda725cf94 (patch) | |
| tree | 8304f69e38ec33d663db21ee26dbee14bf8d7a2f /src/dged/reactor.h | |
| parent | 8d73eace6806bd67852189b1a16de5895c565688 (diff) | |
| download | dged-24cff0ec31970d5d57f61ba99ba7bfdda725cf94.tar.gz dged-24cff0ec31970d5d57f61ba99ba7bfdda725cf94.tar.xz dged-24cff0ec31970d5d57f61ba99ba7bfdda725cf94.zip | |
Implement file reloading
When for examplue using formatters or doing vc updates, it is useful
if the file is reloaded from disk.
Diffstat (limited to 'src/dged/reactor.h')
| -rw-r--r-- | src/dged/reactor.h | 13 |
1 files changed, 13 insertions, 0 deletions
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); |
