Skip to contentSkip to conversation

linux-user : add vmsplice system call

PATCH In review vibi sreenivasan 3 participants 4 messages May 24, 2009 – May 25, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 linux-user : add vmsplice system call

linux-user : add vmsplice system call

---
 linux-user/syscall.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
linux-user/syscall.c +14 -0
index dc726ad..bb32f84 100644
@@ -6598,6 +6598,20 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         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
     default:
     unimplemented:
         gemu_log("qemu: Unsupported syscall: %d\n", num);
Signature · 1 line
1.6.0
#1 lore raw

Hi,

fine that you provide missing syscalls for user mode one after the other.

I have one remark: if the host os kernel is too old to provide the syscalls, they should be #if'ed out (tee, vmsplice & co). Or even emulate the syscall - which can be quite hard.

I put together the new user linux patches together with riku, seems the main qemu staff likes more to make qemu system mode stuff.

Regards, Martin

Quoted 34 lines · vibi sreenivasan

linux-user : add vmsplice system call

---
 linux-user/syscall.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
linux-user/syscall.c +14 -0
index dc726ad..bb32f84 100644
@@ -6598,6 +6598,20 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         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
     default:
     unimplemented:
         gemu_log("qemu: Unsupported syscall: %d\n", num);
#2 lore raw

hi,
Thanks for your comment.

Quoted 4 lines

fine that you provide missing syscalls for user mode one after the other.

I have one remark: if the host os kernel is too old to provide the syscalls, they should be #if'ed out (tee, vmsplice & co).

if the host kernel is too old , i think it will return -1 & set errno to ENOSYS.
So isnt that same as putting #ifdef.

Quoted 1 line

Or even emulate the syscall - which can be quite hard.

Hmm thinking on that. will it be worth?

Quoted 4 lines

I put together the new user linux patches together with riku, seems the main qemu staff likes more to make qemu system mode stuff.

Thanks for that.

Thanks & Regards
vibi sreenivasan

Quoted 40 lines

Regards, Martin

Quoted 34 lines · vibi sreenivasan

linux-user : add vmsplice system call

---
 linux-user/syscall.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
linux-user/syscall.c +14 -0
index dc726ad..bb32f84 100644
@@ -6598,6 +6598,20 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         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
     default:
     unimplemented:
         gemu_log("qemu: Unsupported syscall: %d\n", num);
#3 lore raw
Quoted 9 lines · vibi sreenivasan

hi,
Thanks for your comment.

Quoted 4 lines

fine that you provide missing syscalls for user mode one after the other.

I have one remark: if the host os kernel is too old to provide the syscalls, they should be #if'ed out (tee, vmsplice & co).

if the host kernel is too old , i think it will return -1 & set errno to ENOSYS.
So isnt that same as putting #ifdef.

Yes, having old kernel is not a problem in this. However, having a old libc when compiling qemu can be a problem. Think Redhat RHEL 4 or debian etch. vmsplice() is not available, and compiling qemu would fail.

See how we #ifdef utimensat in linux-user/syscall.c and detect availability in ./configure

Other than that, your patches looked ok.

Quoted 3 lines
Quoted 1 line

Or even emulate the syscall - which can be quite hard.

Hmm thinking on that. will it be worth?

This could be in interest for people who want to run qemu linux-user on non-linux systems (such a *bsd). But that doesn't work yet, and even when people get it working, new syscalls such as tee/splice are not the most important ones to provide emulation for. Very few applications use these syscalls yet.