aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2020-11-17 22:40:07 -0600
committerMark Johnston <markjdb@gmail.com>2020-11-23 22:18:21 -0500
commit1ab681a4bc3f87b09150fa23f9dd4e2c5f5c33cc (patch)
treec28f52cf364b795e49ff0f417100931af98fa733
parent878fb17aeaf5e85e8be85fb4ed20890529dfb354 (diff)
sys/freebsd: add freebsd12_closefrom and close_range
close_range is generally equivalent to the Linux syscall by the same name, except that FreeBSD does not currently have any valid flags defined for it. Prior to FreeBSD 13, closefrom was redefined in terms of close_range in libc and closefrom was pushed to compat12. closefrom(fd) was generally equivalent to `close_range(fd, ~0U, 0)`.
-rw-r--r--CONTRIBUTORS3
-rw-r--r--sys/freebsd/posix_fs.txt3
-rw-r--r--sys/freebsd/posix_fs.txt.const2
3 files changed, 7 insertions, 1 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 607849f34..60f8d8a42 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -80,4 +80,5 @@ VMware
Suraj K Suresh
Palash Oswal
Tiger Gao
-Congyu Liu \ No newline at end of file
+Congyu Liu
+Kyle Evans
diff --git a/sys/freebsd/posix_fs.txt b/sys/freebsd/posix_fs.txt
index cd90e4160..7a936bef9 100644
--- a/sys/freebsd/posix_fs.txt
+++ b/sys/freebsd/posix_fs.txt
@@ -18,6 +18,8 @@ open(file ptr[in, filename], flags flags[open_flags], mode flags[open_mode]) fd
open$dir(file ptr[in, filename], flags flags[open_flags], mode flags[open_mode]) fd_dir
openat(fd fd_dir[opt], file ptr[in, filename], flags flags[open_flags], mode flags[open_mode]) fd
close(fd fd)
+close_range(fd fd, max_fd fd, flags flags[close_range_flags])
+freebsd12_closefrom(fd fd)
read(fd fd, buf buffer[out], count len[buf])
readv(fd fd, vec ptr[in, array[iovec_out]], vlen len[vec])
preadv(fd fd, vec ptr[in, array[iovec_out]], vlen len[vec], off fileoff)
@@ -106,6 +108,7 @@ stat {
open_flags = O_RDONLY, O_WRONLY, O_RDWR, O_APPEND, FASYNC, O_CLOEXEC, O_CREAT, O_DIRECT, O_DIRECTORY, O_EXCL, O_NOCTTY, O_NOFOLLOW, O_NONBLOCK, O_SYNC, O_TRUNC, O_EXEC, O_TTY_INIT, O_VERIFY, O_BENEATH
open_mode = S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH
+close_range_flags = 0
seek_whence = SEEK_SET, SEEK_CUR, SEEK_END, SEEK_DATA, SEEK_HOLE
pipe_flags = O_NONBLOCK, O_CLOEXEC
fadvise_advice = POSIX_FADV_NORMAL, POSIX_FADV_RANDOM, POSIX_FADV_SEQUENTIAL, POSIX_FADV_WILLNEED, POSIX_FADV_DONTNEED, POSIX_FADV_NOREUSE
diff --git a/sys/freebsd/posix_fs.txt.const b/sys/freebsd/posix_fs.txt.const
index 9e10bfbee..98fc04a8d 100644
--- a/sys/freebsd/posix_fs.txt.const
+++ b/sys/freebsd/posix_fs.txt.const
@@ -32,6 +32,7 @@ SEEK_END = 2
SEEK_HOLE = 4
SEEK_SET = 0
SYS_close = 6
+SYS_close_range = 575
SYS_dup = 41
SYS_dup2 = 90
SYS_fpathconf = 192
@@ -39,6 +40,7 @@ SYS_freebsd10_pipe = 42
SYS_freebsd11_fstat = 189
SYS_freebsd11_lstat = 190
SYS_freebsd11_stat = 188
+SYS_freebsd12_closefrom = 509
SYS_fstat = 551
SYS_lpathconf = 513
SYS_lseek = 478