]>
Commit | Line | Data |
---|---|---|
1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ | |
2 | #pragma once | |
3 | ||
4 | #include "forward.h" | |
5 | #include "iterator.h" | |
6 | ||
7 | FDSet* fdset_new(void); | |
8 | FDSet* fdset_free(FDSet *s); | |
9 | FDSet* fdset_free_async(FDSet *s); | |
10 | ||
11 | int fdset_put(FDSet *s, int fd); | |
12 | int fdset_consume(FDSet *s, int fd); | |
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 | ||
18 | int fdset_new_array(FDSet **ret, const int *fds, size_t n_fds); | |
19 | int fdset_new_fill(int filter_cloexec, FDSet **ret); | |
20 | int fdset_new_listen_fds(FDSet **ret, bool unset); | |
21 | ||
22 | int fdset_cloexec(FDSet *fds, bool b); | |
23 | ||
24 | int fdset_to_array(FDSet *fds, int **ret); | |
25 | ||
26 | int fdset_close_others(FDSet *fds); | |
27 | ||
28 | unsigned fdset_size(FDSet *fds); | |
29 | bool fdset_isempty(FDSet *fds); | |
30 | ||
31 | int fdset_iterate(FDSet *s, Iterator *i); | |
32 | ||
33 | int fdset_steal_first(FDSet *fds); | |
34 | ||
35 | void fdset_close(FDSet *fds, bool async); | |
36 | ||
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)) | |
41 | ||
42 | DEFINE_TRIVIAL_CLEANUP_FUNC(FDSet*, fdset_free); | |
43 | #define _cleanup_fdset_free_ _cleanup_(fdset_freep) | |
44 | ||
45 | DEFINE_TRIVIAL_CLEANUP_FUNC(FDSet*, fdset_free_async); |