summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-21 10:11:04 +0000
committerglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-21 10:11:04 +0000
commit12afc11fcda570118c03e88cbb72521e33c38f78 (patch)
tree83bb73d25522128fd5c0fa03034c36d6e77b7098 /io.c
parent6891a1cd5ddd9e5e07d537060a257abaa6833648 (diff)
* 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
Diffstat (limited to 'io.c')
-rw-r--r--io.c6
1 files changed, 5 insertions, 1 deletions
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