[Ocfs2-test-devel] [PATCH 17/59] Splice: Fix conflict definition of splice(2) for splice tests.

Junxiao Bi junxiao.bi at oracle.com
Sun Sep 13 19:44:03 PDT 2015


From: Jeff Liu <jeff.liu at oracle.com>

Signed-off-by: Jie Liu <jeff.liu at oracle.com>
Signed-off-by: Junxiao Bi <junxiao.bi at oracle.com>
---
 api-compat/include/splice.h |   47 ++++++++++++++++++-------------------------
 1 file changed, 20 insertions(+), 27 deletions(-)

diff --git a/api-compat/include/splice.h b/api-compat/include/splice.h
index 08966c1..c7b8c4d 100644
--- a/api-compat/include/splice.h
+++ b/api-compat/include/splice.h
@@ -3,35 +3,28 @@
 
 #include <unistd.h>
 #include <fcntl.h>
-
-#if defined(__i386__)
-
-#define __NR_splice	313
-
-#elif defined(__x86_64__)
-
-#define __NR_splice	275
-
-#elif defined(__powerpc__)
-
-#define __NR_splice	283
-
-#elif defined(__s390__)
-
-#define __NR_splice	306
-
-#elif defined(__ia64__)
-
-#define __NR_splice	1297
-
-#else
-#error unsupported arch
-#endif
-
-int splice(int fdin, loff_t *off_in, int fdout,
-			 loff_t *off_out, size_t len, unsigned int flags)
+#include <sys/syscall.h>
+
+# ifndef __NR_splice
+#  if defined(__i386__)
+#   define __NR_splice		313
+#  elif defined(__x86_64__)
+#   define __NR_splice		275
+#  elif defined(__powerpc__)
+#   define __NR_splice		283
+#  elif defined(__s390__)
+#   define __NR_splice		306
+#  elif defined(__ia64__)
+#   define __NR_splice		1297
+#  else
+#   error unsupported arch
+#  endif
+
+int splice(int fdin, loff_t *off_in, int fdout, loff_t *off_out,
+	   size_t len, unsigned int flags)
 {
 	return syscall(__NR_splice, fdin, off_in, fdout, off_out, len, flags);
 }
+# endif
 
 #endif
-- 
1.7.9.5




More information about the Ocfs2-test-devel mailing list