X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;ds=sidebyside;f=src%2Fshared%2Futil.h;h=73bd9012fd6d1b15358b923961be136337c4a0ed;hb=cc13b327297bb616f8adca10c7503581c8bc5b93;hp=0b7c77b1d4157a30a3b632e7739f0bb61fa5f14d;hpb=979ef53a268d6f54a309fc5c6015df5d4accbbd5;p=elogind.git diff --git a/src/shared/util.h b/src/shared/util.h index 0b7c77b1d..73bd9012f 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -263,7 +263,6 @@ const char* split(const char **state, size_t *l, const char *separator, bool quo for ((state) = (s), (word) = split(&(state), &(length), (separator), (quoted)); (word); (word) = split(&(state), &(length), (separator), (quoted))) pid_t get_parent_of_pid(pid_t pid, pid_t *ppid); -int get_starttime_of_pid(pid_t pid, unsigned long long *st); char *strappend(const char *s, const char *suffix); char *strnappend(const char *s, const char *suffix, size_t length); @@ -426,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); @@ -1032,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))