From f76e183111bc4491ee575c3e2fcc793412acff4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81rni=20Dagur?= Date: Mon, 19 Aug 2019 23:41:14 +0000 Subject: add copy_file_range system call wrapper --- include/unistd.h | 1 + src/linux/copy_file_range.c | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 src/linux/copy_file_range.c diff --git a/include/unistd.h b/include/unistd.h index 9485da7a..b9b23a16 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -188,6 +188,7 @@ char *get_current_dir_name(void); int syncfs(int); int euidaccess(const char *, int); int eaccess(const char *, int); +ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned); #endif #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) diff --git a/src/linux/copy_file_range.c b/src/linux/copy_file_range.c new file mode 100644 index 00000000..dd4b1333 --- /dev/null +++ b/src/linux/copy_file_range.c @@ -0,0 +1,8 @@ +#define _GNU_SOURCE +#include +#include "syscall.h" + +ssize_t copy_file_range(int fd_in, off_t *off_in, int fd_out, off_t *off_out, size_t len, unsigned flags) +{ + return syscall(SYS_copy_file_range, fd_in, off_in, fd_out, off_out, len, flags); +} -- cgit v1.2.1