瀏覽代碼

avr32: splice(), vmsplice() and tee() support

Add the necessary prototypes and definitions for splice(), vmsplice()
and tee() to work. Without this, they won't even compile.
Haavard Skinnemoen 16 年之前
父節點
當前提交
8e2424ffec
共有 1 個文件被更改,包括 31 次插入0 次删除
  1. 31 0
      libc/sysdeps/linux/avr32/bits/fcntl.h

+ 31 - 0
libc/sysdeps/linux/avr32/bits/fcntl.h

@@ -3,6 +3,9 @@
 #endif
 
 #include <sys/types.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
 
 /*
  * open/fcntl - O_SYNC is only implemented on blocks devices and on files
@@ -163,3 +166,31 @@ struct flock64 {
 # define POSIX_FADV_DONTNEED    4 /* Don't need these pages.  */
 # define POSIX_FADV_NOREUSE     5 /* Data will be accessed once.  */
 #endif
+
+#ifdef __USE_GNU
+
+/* Flags for splice() and vmsplice() */
+# define SPLICE_F_MOVE		1	/* Move pages instead of copying */
+# define SPLICE_F_NONBLOCK	2	/* Don't block on the pipe splicing
+					   (but we may still block on the fd
+					   we splice from/to) */
+# define SPLICE_F_MORE		4	/* Expect more data */
+# define SPLICE_F_GIFT		8	/* Pages passed in are a gift */
+
+__BEGIN_DECLS
+
+/* Splice address range into a pipe */
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+			 size_t __count, unsigned int __flags);
+
+/* Splice two files together */
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+		       __off64_t *__offout, size_t __len,
+		       unsigned int __flags);
+
+/* In-kernel implementation of tee for pipe buffers */
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+		    unsigned int __flags);
+
+__END_DECLS
+#endif