Patchwork [04/11] linux-user: Implement gethostname

login
register
mail settings
Submitter riku.voipio@linaro.org
Date Oct. 12, 2012, 12:36 p.m.
Message ID <3d21d29c32380384e5ee5b804d0b0bf720469d97.1350044677.git.riku.voipio@linaro.org>
Download mbox | patch
Permalink /patch/191120/
State New
Headers show

Comments

riku.voipio@linaro.org - Oct. 12, 2012, 12:36 p.m.
From: Richard Henderson <rth@twiddle.net>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
 linux-user/syscall.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 038aefe..89c74ad 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8868,6 +8868,19 @@  abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         break;
     }
 #endif
+#ifdef TARGET_NR_gethostname
+    case TARGET_NR_gethostname:
+    {
+        char *name = lock_user(VERIFY_WRITE, arg1, arg2, 0);
+        if (name) {
+            ret = get_errno(gethostname(name, arg2));
+            unlock_user(name, arg1, arg2);
+        } else {
+            ret = -TARGET_EFAULT;
+        }
+        break;
+    }
+#endif
     default:
     unimplemented:
         gemu_log("qemu: Unsupported syscall: %d\n", num);