• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* Copyright (c) 2021 SUSE LLC  */
3 
4 #ifndef LAPI_CLOSE_RANGE__
5 # define LAPI_CLOSE_RANGE__
6 
7 # include "lapi/syscalls.h"
8 
9 # ifdef HAVE_LINUX_CLOSE_RANGE_H
10 #  include <linux/close_range.h>
11 # endif
12 
13 # ifndef CLOSE_RANGE_UNSHARE
14 #  define CLOSE_RANGE_UNSHARE	(1U << 1)
15 # endif
16 
17 # ifndef CLOSE_RANGE_CLOEXEC
18 #  define CLOSE_RANGE_CLOEXEC	(1U << 2)
19 # endif
20 
21 # ifndef HAVE_CLOSE_RANGE
close_range(unsigned int fd,unsigned int max_fd,unsigned int flags)22 static inline int close_range(unsigned int fd, unsigned int max_fd,
23 			      unsigned int flags)
24 {
25 	return tst_syscall(__NR_close_range, fd, max_fd, flags);
26 }
27 # endif
28 #endif	/* LAPI_CLOSE_RANGE_H__ */
29