master
h 20 lines 472 Bytes
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 #ifndef CLOSE_RANGE_H
4 #define CLOSE_RANGE_H
5
6 #define CLOSE_RANGE_FD_MAX (int)(~0U)
7
8 #ifndef CLOSE_RANGE_UNSHARE
9 #define CLOSE_RANGE_UNSHARE (1U << 1)
10 #endif
11
12 #ifndef CLOSE_RANGE_CLOEXEC
13 #define CLOSE_RANGE_CLOEXEC (1U << 2)
14 #endif
15
16 int os_get_fd_open_max(void);
17 void os_close_range(int first, int last, int flags);
18 void os_close_all_non_std_open_fds_except(const int fds[], size_t fds_num, int flags);
19
20 #endif //CLOSE_RANGE_H