]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/fdset.h
zsh: remove _files prefixes
[thirdparty/systemd.git] / src / shared / fdset.h
CommitLineData
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
7FDSet* fdset_new(void);
a354329f 8FDSet* fdset_free(FDSet *s);
33dd8945 9FDSet* fdset_free_async(FDSet *s);
a16e1123
LP
10
11int fdset_put(FDSet *s, int fd);
e829f28c 12int fdset_consume(FDSet *s, int fd);
a16e1123
LP
13int fdset_put_dup(FDSet *s, int fd);
14
15bool fdset_contains(FDSet *s, int fd);
16int fdset_remove(FDSet *s, int fd);
17
da6053d0 18int fdset_new_array(FDSet **ret, const int *fds, size_t n_fds);
a3dff21a 19int fdset_new_fill(int filter_cloexec, FDSet **ret);
a354329f 20int fdset_new_listen_fds(FDSet **ret, bool unset);
a16e1123
LP
21
22int fdset_cloexec(FDSet *fds, bool b);
e83c7163 23
bdcad22e
LP
24int fdset_to_array(FDSet *fds, int **ret);
25
e83c7163
LP
26int fdset_close_others(FDSet *fds);
27
28unsigned fdset_size(FDSet *fds);
a354329f 29bool fdset_isempty(FDSet *fds);
e83c7163
LP
30
31int fdset_iterate(FDSet *s, Iterator *i);
32
a354329f
LP
33int fdset_steal_first(FDSet *fds);
34
33dd8945 35void 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 42DEFINE_TRIVIAL_CLEANUP_FUNC(FDSet*, fdset_free);
51d122af 43#define _cleanup_fdset_free_ _cleanup_(fdset_freep)
33dd8945
LP
44
45DEFINE_TRIVIAL_CLEANUP_FUNC(FDSet*, fdset_free_async);