summary refs log tree commit diff stats
path: root/linux-user/syscall.c
diff options
context:
space:
mode:
authorvibisreenivasan <vibi_sreenivasan@cms.com>2009-05-16 18:32:41 +0530
committerRiku Voipio <riku.voipio@nokia.com>2009-06-16 16:58:07 +0300
commit3ce34dfb42e02225f2688ef8ad4b9664a4c98e46 (patch)
tree8d86132965ed6f5d5a7bc8a99e21c717c87c5cab /linux-user/syscall.c
parent099d6b0fe9e6d5855403d2d0a8ae800b7bdb24a7 (diff)
downloadfocaccia-qemu-3ce34dfb42e02225f2688ef8ad4b9664a4c98e46.tar.gz
focaccia-qemu-3ce34dfb42e02225f2688ef8ad4b9664a4c98e46.zip
linux-user: add tee, splice and vmsplice
Add support for tee, splice and vmsplice.

Originally from: vibi sreenivasan <vibi_sreenivasan@cms.com>

Riku: squashed patches together, added a test to configure
and removed compliler warning by picking up correct type for
splice param

Signed-off-by: vibisreenivasan <vibi_sreenivasan@cms.com>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r--linux-user/syscall.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 36eb9f5b53..fdf74e12f9 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:
+        {
+            loff_t loff_in, loff_out;
+            loff_t *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);