summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2020-04-12 21:23:19 +0000
committerKyle Evans <kevans@FreeBSD.org>2020-04-12 21:23:19 +0000
commit472ced39efb537374068f06b348fe5dac389c45a (patch)
tree30f4cf81fcfd1a7f955265b34c52d3265a977d9a /include
parent1d3500e0658360e7475fbf0e3bdf9fe499c2c18a (diff)
downloadsrc-test2-472ced39efb537374068f06b348fe5dac389c45a.tar.gz
src-test2-472ced39efb537374068f06b348fe5dac389c45a.zip
Implement a close_range(2) syscall
close_range(min, max, flags) allows for a range of descriptors to be closed. The Python folk have indicated that they would much prefer this interface to closefrom(2), as the case may be that they/someone have special fds dup'd to higher in the range and they can't necessarily closefrom(min) because they don't want to hit the upper range, but relocating them to lower isn't necessarily feasible. sys_closefrom has been rewritten to use kern_close_range() using ~0U to indicate closing to the end of the range. This was chosen rather than requiring callers of kern_close_range() to hold FILEDESC_SLOCK across the call to kern_close_range for simplicity. The flags argument of close_range(2) is currently unused, so any flags set is currently EINVAL. It was added to the interface in Linux so that future flags could be added for, e.g., "halt on first error" and things of this nature. This patch is based on a syscall of the same design that is expected to be merged into Linux. Reviewed by: kib, markj, vangyzen (all slightly earlier revisions) Differential Revision: https://reviews.freebsd.org/D21627
Notes
Notes: svn path=/head/; revision=359836
Diffstat (limited to 'include')
-rw-r--r--include/unistd.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/unistd.h b/include/unistd.h
index 5a4991ef9fe1..02df2515eaaa 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -494,6 +494,7 @@ struct crypt_data {
int acct(const char *);
int async_daemon(void);
int check_utility_compat(const char *);
+int close_range(unsigned int, unsigned int, int);
ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned int);
const char *
crypt_get_format(void);