X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Ffdset.h;h=340438d7c401ce9cc4565242e46f11b34801a7dd;hb=17384d7f95169dad5f769431374fc2c08101206d;hp=1a26005183df59451fa9c11cd0aa1f4030d5e757;hpb=51d122af23533b0b8318911c4fc8b128ad8eafb7;p=elogind.git diff --git a/src/shared/fdset.h b/src/shared/fdset.h index 1a2600518..340438d7c 100644 --- a/src/shared/fdset.h +++ b/src/shared/fdset.h @@ -22,35 +22,36 @@ ***/ #include "set.h" -#include "util.h" typedef struct FDSet FDSet; FDSet* fdset_new(void); -void fdset_free(FDSet *s); +FDSet* fdset_free(FDSet *s); int fdset_put(FDSet *s, int fd); int fdset_put_dup(FDSet *s, int fd); +int fdset_consume(FDSet *s, int fd); bool fdset_contains(FDSet *s, int fd); int fdset_remove(FDSet *s, int fd); -int fdset_new_fill(FDSet **_s); -int fdset_new_listen_fds(FDSet **_s, bool unset); +int fdset_new_array(FDSet **ret, int *fds, unsigned n_fds); +int fdset_new_fill(FDSet **ret); +int fdset_new_listen_fds(FDSet **ret, bool unset); int fdset_cloexec(FDSet *fds, bool b); int fdset_close_others(FDSet *fds); unsigned fdset_size(FDSet *fds); +bool fdset_isempty(FDSet *fds); int fdset_iterate(FDSet *s, Iterator *i); +int fdset_steal_first(FDSet *fds); + #define FDSET_FOREACH(fd, fds, i) \ for ((i) = ITERATOR_FIRST, (fd) = fdset_iterate((fds), &(i)); (fd) >= 0; (fd) = fdset_iterate((fds), &(i))) -static inline void fdset_freep(FDSet **fds) { - if (*fds) - fdset_free(*fds); -} +DEFINE_TRIVIAL_CLEANUP_FUNC(FDSet*, fdset_free); #define _cleanup_fdset_free_ _cleanup_(fdset_freep)