]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/fdset.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
10 typedef struct FDSet FDSet
;
12 FDSet
* fdset_new(void);
13 FDSet
* fdset_free(FDSet
*s
);
15 int fdset_put(FDSet
*s
, int fd
);
16 int fdset_consume(FDSet
*s
, int fd
);
17 int fdset_put_dup(FDSet
*s
, int fd
);
19 bool fdset_contains(FDSet
*s
, int fd
);
20 int fdset_remove(FDSet
*s
, int fd
);
22 int fdset_new_array(FDSet
**ret
, const int *fds
, size_t n_fds
);
23 int fdset_new_fill(int filter_cloexec
, FDSet
**ret
);
24 int fdset_new_listen_fds(FDSet
**ret
, bool unset
);
26 int fdset_cloexec(FDSet
*fds
, bool b
);
28 int fdset_to_array(FDSet
*fds
, int **ret
);
30 int fdset_close_others(FDSet
*fds
);
32 unsigned fdset_size(FDSet
*fds
);
33 bool fdset_isempty(FDSet
*fds
);
35 int fdset_iterate(FDSet
*s
, Iterator
*i
);
37 int fdset_steal_first(FDSet
*fds
);
39 void fdset_close(FDSet
*fds
);
41 #define _FDSET_FOREACH(fd, fds, i) \
42 for (Iterator i = ITERATOR_FIRST; ((fd) = fdset_iterate((fds), &i)) >= 0; )
43 #define FDSET_FOREACH(fd, fds) \
44 _FDSET_FOREACH(fd, fds, UNIQ_T(i, UNIQ))
46 DEFINE_TRIVIAL_CLEANUP_FUNC(FDSet
*, fdset_free
);
47 #define _cleanup_fdset_free_ _cleanup_(fdset_freep)