]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/fdset.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 Copyright 2010 Lennart Poettering
14 typedef struct FDSet FDSet
;
16 FDSet
* fdset_new(void);
17 FDSet
* fdset_free(FDSet
*s
);
19 int fdset_put(FDSet
*s
, int fd
);
20 int fdset_put_dup(FDSet
*s
, int fd
);
22 bool fdset_contains(FDSet
*s
, int fd
);
23 int fdset_remove(FDSet
*s
, int fd
);
25 int fdset_new_array(FDSet
**ret
, const int *fds
, size_t n_fds
);
26 int fdset_new_fill(FDSet
**ret
);
27 int fdset_new_listen_fds(FDSet
**ret
, bool unset
);
29 int fdset_cloexec(FDSet
*fds
, bool b
);
31 int fdset_close_others(FDSet
*fds
);
33 unsigned fdset_size(FDSet
*fds
);
34 bool fdset_isempty(FDSet
*fds
);
36 int fdset_iterate(FDSet
*s
, Iterator
*i
);
38 int fdset_steal_first(FDSet
*fds
);
40 #define FDSET_FOREACH(fd, fds, i) \
41 for ((i) = ITERATOR_FIRST, (fd) = fdset_iterate((fds), &(i)); (fd) >= 0; (fd) = fdset_iterate((fds), &(i)))
43 DEFINE_TRIVIAL_CLEANUP_FUNC(FDSet
*, fdset_free
);
44 #define _cleanup_fdset_free_ _cleanup_(fdset_freep)