Patchwork [2/6] linux-user: Implement gethostname

login
register
mail settings
Submitter Richard Henderson
Date Oct. 11, 2012, 7:22 p.m.
Message ID <1349983336-9974-3-git-send-email-rth@twiddle.net>
Download mbox | patch
Permalink /patch/190981/
State New
Headers show

Comments

Richard Henderson - Oct. 11, 2012, 7:22 p.m.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 linux-user/syscall.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
Peter Maydell - Oct. 11, 2012, 7:43 p.m.
On 11 October 2012 20:22, Richard Henderson <rth@twiddle.net> wrote:
> Signed-off-by: Richard Henderson <rth@twiddle.net>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

-- PMM

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 8708b31..462d11b 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8864,6 +8864,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);