]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/fdset.h
96a17c78350a1df52eff635a87d9134963eac326
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
7 FDSet
* fdset_new(void);
8 FDSet
* fdset_free(FDSet
*s
);
9 FDSet
* fdset_free_async(FDSet
*s
);
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
);
15 bool fdset_contains(FDSet
*s
, int fd
);
16 int fdset_remove(FDSet
*s
, int fd
);
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
);
22 int fdset_cloexec(FDSet
*fds
, bool b
);
24 int fdset_to_array(FDSet
*fds
, int **ret
);
26 int fdset_close_others(FDSet
*fds
);
28 unsigned fdset_size(FDSet
*fds
);
29 bool fdset_isempty(FDSet
*fds
);
31 int fdset_iterate(FDSet
*s
, Iterator
*i
);
33 int fdset_steal_first(FDSet
*fds
);
35 void fdset_close(FDSet
*fds
, bool async
);
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))
42 DEFINE_TRIVIAL_CLEANUP_FUNC(FDSet
*, fdset_free
);
43 #define _cleanup_fdset_free_ _cleanup_(fdset_freep)
45 DEFINE_TRIVIAL_CLEANUP_FUNC(FDSet
*, fdset_free_async
);