[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 17/21] linux-user: add tee, splice and vmsplice
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PATCH 17/21] linux-user: add tee, splice and vmsplice |
Date: |
Fri, 12 Jun 2009 16:50:27 +0300 |
From: vibisreenivasan <address@hidden>
Add support for tee, splice and vmsplice.
Originally from: vibi sreenivasan <address@hidden>
Riku: squashed patches together and added a test to configure
From: vibisreenivasan <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
configure | 23 +++++++++++++++++++++++
linux-user/syscall.c | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/configure b/configure
index 4187eb2..cbcae1f 100755
--- a/configure
+++ b/configure
@@ -1318,6 +1318,26 @@ if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
pipe2=yes
fi
+# check if tee/splice is there. vmsplice was added same time.
+splice=no
+cat > $TMPC << EOF
+#define _GNU_SOURCE
+#include <unistd.h>
+#include <fcntl.h>
+#include <limits.h>
+
+int main(void)
+{
+ int len, fd;
+ len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
+ splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
+ return 0;
+}
+EOF
+if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
+ splice=yes
+fi
+
# Check if tools are available to build documentation.
if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o !
-x "`which pod2man 2>/dev/null`" \) ; then
build_docs="no"
@@ -1722,6 +1742,9 @@ fi
if test "$pipe2" = "yes" ; then
echo "#define CONFIG_PIPE2 1" >> $config_h
fi
+if test "$splice" = "yes" ; then
+ echo "#define CONFIG_SPLICE 1" >> $config_h
+fi
if test "$inotify" = "yes" ; then
echo "#define CONFIG_INOTIFY 1" >> $config_h
fi
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 36eb9f5..ff35881 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6865,6 +6865,46 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
arg1,
break;
#endif
+#ifdef CONFIG_SPLICE
+#ifdef TARGET_NR_tee
+ case TARGET_NR_tee:
+ {
+ ret = get_errno(tee(arg1,arg2,arg3,arg4));
+ }
+ break;
+#endif
+#ifdef TARGET_NR_splice
+ case TARGET_NR_splice:
+ {
+ long long int loff_in, loff_out;
+ long long int *ploff_in = NULL, *ploff_out = NULL;
+ if(arg2) {
+ get_user_u64(loff_in, arg2);
+ ploff_in = &loff_in;
+ }
+ if(arg4) {
+ get_user_u64(loff_out, arg2);
+ ploff_out = &loff_out;
+ }
+ ret = get_errno(splice(arg1, ploff_in, arg3, ploff_out, arg5,
arg6));
+ }
+ break;
+#endif
+#ifdef TARGET_NR_vmsplice
+ case TARGET_NR_vmsplice:
+ {
+ int count = arg3;
+ struct iovec *vec;
+
+ vec = alloca(count * sizeof(struct iovec));
+ if (lock_iovec(VERIFY_READ, vec, arg2, count, 1) < 0)
+ goto efault;
+ ret = get_errno(vmsplice(arg1, vec, count, arg4));
+ unlock_iovec(vec, arg2, count, 0);
+ }
+ break;
+#endif
+#endif /* CONFIG_SPLICE */
default:
unimplemented:
gemu_log("qemu: Unsupported syscall: %d\n", num);
--
1.6.2.1
- [Qemu-devel] [PATCH 14/21] add futex wake op, (continued)
- [Qemu-devel] [PATCH 14/21] add futex wake op, riku . voipio, 2009/06/12
- [Qemu-devel] [PATCH 07/21] linux-user: fix utimensat, riku . voipio, 2009/06/12
- [Qemu-devel] [PATCH 15/21] linux-user: update syscall list, riku . voipio, 2009/06/12
- [Qemu-devel] [PATCH 02/21] Implement shm* syscalls and fix 64/32bit errors, riku . voipio, 2009/06/12
- [Qemu-devel] [PATCH 10/21] linux-user: Added IP_ADD_MEMBERSHIP/IP_DROP_MEMBERSHIP flags to setsockopt, riku . voipio, 2009/06/12
- [Qemu-devel] [PATCH 12/21] linux-user: include linux/fs.h, riku . voipio, 2009/06/12
- [Qemu-devel] [PATCH 20/21] linux-user/syscall.c: define _ATFILE_SOURCE, riku . voipio, 2009/06/12
- [Qemu-devel] [PATCH 16/21] linux-user: implement pipe2 [v3], riku . voipio, 2009/06/12
- [Qemu-devel] [PATCH 17/21] linux-user: add tee, splice and vmsplice,
riku . voipio <=
- [Qemu-devel] [PATCH 08/21] Fix struct termios host - target translation, riku . voipio, 2009/06/12
[Qemu-devel] [PATCH 06/21] Revived GUEST_BASE support for usermode emulation targets [v5], riku . voipio, 2009/06/12
[Qemu-devel] [PATCH 21/21] linux-user: remove duplicate tswap32() from do_getsockopt(), riku . voipio, 2009/06/12