[前][次][番号順一覧][スレッド一覧]

ruby-changes:54679

From: glass <ko1@a...>
Date: Mon, 21 Jan 2019 19:11:11 +0900 (JST)
Subject: [ruby-changes:54679] glass:r66895 (trunk): * io.c: use copy_file_range() if defined

glass	2019-01-21 19:11:04 +0900 (Mon, 21 Jan 2019)

  New Revision: 66895

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66895

  Log:
    * io.c: use copy_file_range() if defined
    
    * configure.ac: check copy_file_range()

  Modified files:
    trunk/configure.ac
    trunk/io.c
Index: configure.ac
===================================================================
--- configure.ac	(revision 66894)
+++ configure.ac	(revision 66895)
@@ -1793,6 +1793,7 @@ AC_CHECK_FUNCS(atan2l atan2f) https://github.com/ruby/ruby/blob/trunk/configure.ac#L1793
 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)
Index: io.c
===================================================================
--- io.c	(revision 66894)
+++ io.c	(revision 66895)
@@ -10828,7 +10828,7 @@ nogvl_copy_stream_wait_write(struct copy https://github.com/ruby/ruby/blob/trunk/io.c#L10828
     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 https://github.com/ruby/ruby/blob/trunk/io.c#L10837
 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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]