]> git.ipfire.org Git - thirdparty/systemd.git/blame_incremental - src/shared/fdset.h
Fixes for vscode/intellisense parsing (#38040)
[thirdparty/systemd.git] / src / shared / fdset.h
... / ...
CommitLineData
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2#pragma once
3
4#include "forward.h"
5#include "iterator.h"
6
7FDSet* fdset_new(void);
8FDSet* fdset_free(FDSet *s);
9FDSet* fdset_free_async(FDSet *s);
10
11int fdset_put(FDSet *s, int fd);
12int fdset_consume(FDSet *s, int fd);
13int fdset_put_dup(FDSet *s, int fd);
14
15bool fdset_contains(FDSet *s, int fd);
16int fdset_remove(FDSet *s, int fd);
17
18int fdset_new_array(FDSet **ret, const int *fds, size_t n_fds);
19int fdset_new_fill(int filter_cloexec, FDSet **ret);
20int fdset_new_listen_fds(FDSet **ret, bool unset);
21
22int fdset_cloexec(FDSet *fds, bool b);
23
24int fdset_to_array(FDSet *fds, int **ret);
25
26int fdset_close_others(FDSet *fds);
27
28unsigned fdset_size(FDSet *fds);
29bool fdset_isempty(FDSet *fds);
30
31int fdset_iterate(FDSet *s, Iterator *i);
32
33int fdset_steal_first(FDSet *fds);
34
35void 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
42DEFINE_TRIVIAL_CLEANUP_FUNC(FDSet*, fdset_free);
43#define _cleanup_fdset_free_ _cleanup_(fdset_freep)
44
45DEFINE_TRIVIAL_CLEANUP_FUNC(FDSet*, fdset_free_async);