X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fshared%2Futil.h;h=73bd9012fd6d1b15358b923961be136337c4a0ed;hp=b6fdf833022dc2732c94b11fab6fded4601025c0;hb=cc13b327297bb616f8adca10c7503581c8bc5b93;hpb=32802361561403cb6441198c82d9c499e0513863 diff --git a/src/shared/util.h b/src/shared/util.h index b6fdf8330..73bd9012f 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -425,7 +425,7 @@ int sigaction_many(const struct sigaction *sa, ...); int fopen_temporary(const char *path, FILE **_f, char **_temp_path); ssize_t loop_read(int fd, void *buf, size_t nbytes, bool do_poll); -ssize_t loop_write(int fd, const void *buf, size_t nbytes, bool do_poll); +int loop_write(int fd, const void *buf, size_t nbytes, bool do_poll); bool is_device_path(const char *path); @@ -1031,3 +1031,10 @@ int unquote_many_words(const char **p, ...) _sentinel_; int free_and_strdup(char **p, const char *s); int sethostname_idempotent(const char *s); + +#define INOTIFY_EVENT_MAX (sizeof(struct inotify_event) + NAME_MAX + 1) + +#define FOREACH_INOTIFY_EVENT(e, buffer, sz) \ + for ((e) = (struct inotify_event*) (buffer); \ + (uint8_t*) (e) < (uint8_t*) (buffer) + (sz); \ + (e) = (struct inotify_event*) ((uint8_t*) (e) + sizeof(struct inotify_event) + (e)->len))