X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fshared%2Futil.h;h=3d31cb3f042b59aba2c4f5dd113db44d04c197ae;hp=d3e78e43ca7068a9271f58c184272f4da4587baa;hb=4968105790c65af58d4ab42bffa2a4bedc0be8ee;hpb=ee451d766a64117a41ec36dd71e61683c9d9b83c diff --git a/src/shared/util.h b/src/shared/util.h index d3e78e43c..3d31cb3f0 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -42,6 +42,7 @@ #include #include #include +#include #if SIZEOF_PID_T == 4 # define PID_FMT "%" PRIu32 @@ -533,7 +534,7 @@ bool tty_is_console(const char *tty) _pure_; int vtnr_from_tty(const char *tty); const char *default_term_for_tty(const char *tty); -void execute_directory(const char *directory, DIR *_d, usec_t timeout, char *argv[]); +void execute_directory(const char *directory, usec_t timeout, char *argv[]); int kill_and_sigcont(pid_t pid, int sig); @@ -1047,10 +1048,31 @@ 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); \ + for ((e) = &buffer.ev; \ + (uint8_t*) (e) < (uint8_t*) (buffer.raw) + (sz); \ (e) = (struct inotify_event*) ((uint8_t*) (e) + sizeof(struct inotify_event) + (e)->len)) +union inotify_event_buffer { + struct inotify_event ev; + uint8_t raw[INOTIFY_EVENT_MAX]; +}; + #define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW) int ptsname_malloc(int fd, char **ret); + +int openpt_in_namespace(pid_t pid, int flags); + +ssize_t fgetxattrat_fake(int dirfd, const char *filename, const char *attribute, void *value, size_t size, int flags); + +int fd_setcrtime(int fd, usec_t usec); +int fd_getcrtime(int fd, usec_t *usec); +int path_getcrtime(const char *p, usec_t *usec); +int fd_getcrtime_at(int dirfd, const char *name, usec_t *usec, int flags); + +int same_fd(int a, int b); + +int chattr_fd(int fd, bool b, int mask); +int chattr_path(const char *p, bool b, int mask); + +#define RLIMIT_MAKE_CONST(lim) ((struct rlimit) { lim, lim })