]>
Commit | Line | Data |
---|---|---|
db9ecf05 | 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
c2f1db8f | 2 | #pragma once |
a16e1123 | 3 | |
69a283c5 DDM |
4 | #include "forward.h" |
5 | #include "iterator.h" | |
a16e1123 LP |
6 | |
7 | FDSet* fdset_new(void); | |
a354329f | 8 | FDSet* fdset_free(FDSet *s); |
33dd8945 | 9 | FDSet* fdset_free_async(FDSet *s); |
a16e1123 LP |
10 | |
11 | int fdset_put(FDSet *s, int fd); | |
e829f28c | 12 | int fdset_consume(FDSet *s, int fd); |
a16e1123 LP |
13 | int fdset_put_dup(FDSet *s, int fd); |
14 | ||
15 | bool fdset_contains(FDSet *s, int fd); | |
16 | int fdset_remove(FDSet *s, int fd); | |
17 | ||
da6053d0 | 18 | int fdset_new_array(FDSet **ret, const int *fds, size_t n_fds); |
a3dff21a | 19 | int fdset_new_fill(int filter_cloexec, FDSet **ret); |
a354329f | 20 | int fdset_new_listen_fds(FDSet **ret, bool unset); |
a16e1123 LP |
21 | |
22 | int fdset_cloexec(FDSet *fds, bool b); | |
e83c7163 | 23 | |
bdcad22e LP |
24 | int fdset_to_array(FDSet *fds, int **ret); |
25 | ||
e83c7163 LP |
26 | int fdset_close_others(FDSet *fds); |
27 | ||
28 | unsigned fdset_size(FDSet *fds); | |
a354329f | 29 | bool fdset_isempty(FDSet *fds); |
e83c7163 LP |
30 | |
31 | int fdset_iterate(FDSet *s, Iterator *i); | |
32 | ||
a354329f LP |
33 | int fdset_steal_first(FDSet *fds); |
34 | ||
33dd8945 | 35 | void fdset_close(FDSet *fds, bool async); |
e4077ff6 | 36 | |
90e74a66 ZJS |
37 | #define _FDSET_FOREACH(fd, fds, i) \ |
38 | for (Iterator i = ITERATOR_FIRST; ((fd) = fdset_iterate((fds), &i)) >= 0; ) | |
39 | #define FDSET_FOREACH(fd, fds) \ | |
40 | _FDSET_FOREACH(fd, fds, UNIQ_T(i, UNIQ)) | |
51d122af | 41 | |
14bf2c9d | 42 | DEFINE_TRIVIAL_CLEANUP_FUNC(FDSet*, fdset_free); |
51d122af | 43 | #define _cleanup_fdset_free_ _cleanup_(fdset_freep) |
33dd8945 LP |
44 | |
45 | DEFINE_TRIVIAL_CLEANUP_FUNC(FDSet*, fdset_free_async); |