From 12afc11fcda570118c03e88cbb72521e33c38f78 Mon Sep 17 00:00:00 2001 From: glass Date: Mon, 21 Jan 2019 10:11:04 +0000 Subject: * io.c: use copy_file_range() if defined * configure.ac: check copy_file_range() git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'io.c') 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 -- cgit v1.2.3