]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/fdset.h
man: fix incorrectly placed full stop
[thirdparty/systemd.git] / src / shared / fdset.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
c2f1db8f 2#pragma once
a16e1123 3
11c3a366
TA
4#include <stdbool.h>
5
11c3a366
TA
6#include "hashmap.h"
7#include "macro.h"
93cc7779 8#include "set.h"
e83c7163 9
a16e1123
LP
10typedef struct FDSet FDSet;
11
12FDSet* fdset_new(void);
a354329f 13FDSet* fdset_free(FDSet *s);
a16e1123
LP
14
15int fdset_put(FDSet *s, int fd);
16int fdset_put_dup(FDSet *s, int fd);
17
18bool fdset_contains(FDSet *s, int fd);
19int fdset_remove(FDSet *s, int fd);
20
da6053d0 21int fdset_new_array(FDSet **ret, const int *fds, size_t n_fds);
a354329f
LP
22int fdset_new_fill(FDSet **ret);
23int fdset_new_listen_fds(FDSet **ret, bool unset);
a16e1123
LP
24
25int fdset_cloexec(FDSet *fds, bool b);
e83c7163
LP
26
27int fdset_close_others(FDSet *fds);
28
29unsigned fdset_size(FDSet *fds);
a354329f 30bool fdset_isempty(FDSet *fds);
e83c7163
LP
31
32int fdset_iterate(FDSet *s, Iterator *i);
33
a354329f
LP
34int fdset_steal_first(FDSet *fds);
35
e4077ff6
LP
36void fdset_close(FDSet *fds);
37
e83c7163
LP
38#define FDSET_FOREACH(fd, fds, i) \
39 for ((i) = ITERATOR_FIRST, (fd) = fdset_iterate((fds), &(i)); (fd) >= 0; (fd) = fdset_iterate((fds), &(i)))
51d122af 40
14bf2c9d 41DEFINE_TRIVIAL_CLEANUP_FUNC(FDSet*, fdset_free);
51d122af 42#define _cleanup_fdset_free_ _cleanup_(fdset_freep)