aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rw-r--r--io.c6
2 files changed, 6 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index e578f1ea4e..a585ce8e4b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1793,6 +1793,7 @@ AC_CHECK_FUNCS(atan2l atan2f)
AC_CHECK_FUNCS(chroot)
AC_CHECK_FUNCS(chsize)
AC_CHECK_FUNCS(clock_gettime)
+AC_CHECK_FUNCS(copy_file_range)
AC_CHECK_FUNCS(cosh)
AC_CHECK_FUNCS(crypt_r)
AC_CHECK_FUNCS(daemon)
diff --git a/io.c b/io.c
index 7de405de32..1bd5aa7782 100644
--- a/io.c
+++ b/io.c
@@ -10828,7 +10828,7 @@ nogvl_copy_stream_wait_write(struct copy_stream_struct *stp)
return 0;
}
-#if defined __linux__ && defined __NR_copy_file_range
+#if defined HAVE_COPY_FILE_RANGE || (defined __linux__ && defined __NR_copy_file_range)
# define USE_COPY_FILE_RANGE
#endif
@@ -10837,7 +10837,11 @@ nogvl_copy_stream_wait_write(struct copy_stream_struct *stp)
static ssize_t
simple_copy_file_range(int in_fd, off_t *in_offset, int out_fd, off_t *out_offset, size_t count, unsigned int flags)
{
+#ifdef HAVE_COPY_FILE_RANGE
+ return copy_file_range(in_fd, in_offset, out_fd, out_offset, count, flags);
+#else
return syscall(__NR_copy_file_range, in_fd, in_offset, out_fd, out_offset, count, flags);
+#endif
}
static int