[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v7 64/74] linux-user: Split out gethostname, sethost
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH v7 64/74] linux-user: Split out gethostname, sethostname |
Date: |
Sun, 19 May 2019 13:37:16 -0700 |
Signed-off-by: Richard Henderson <address@hidden>
---
linux-user/syscall-defs.h | 4 ++++
linux-user/syscall-proc.inc.c | 28 ++++++++++++++++++++++++++++
linux-user/syscall.c | 19 -------------------
linux-user/strace.list | 6 ------
4 files changed, 32 insertions(+), 25 deletions(-)
diff --git a/linux-user/syscall-defs.h b/linux-user/syscall-defs.h
index 77d750f66f..3ba697fd53 100644
--- a/linux-user/syscall-defs.h
+++ b/linux-user/syscall-defs.h
@@ -59,6 +59,9 @@ SYSCALL_DEF(futimesat, ARG_ATDIRFD, ARG_STR, ARG_PTR);
#ifdef TARGET_NR_fork
SYSCALL_DEF(fork);
#endif
+#ifdef TARGET_NR_gethostname
+SYSCALL_DEF(gethostname, ARG_PTR, ARG_DEC);
+#endif
SYSCALL_DEF(getpgid, ARG_DEC);
#ifdef TARGET_NR_getpgrp
SYSCALL_DEF(getpgrp);
@@ -207,6 +210,7 @@ SYSCALL_DEF(semctl, ARG_DEC, ARG_DEC, ARG_DEC, ARG_HEX);
#if !defined(SYSCALL_TABLE) || defined(TARGET_NR_semget)
SYSCALL_DEF(semget, ARG_DEC, ARG_DEC, ARG_HEX);
#endif
+SYSCALL_DEF(sethostname, ARG_STR);
SYSCALL_DEF(setpgid, ARG_DEC, ARG_DEC);
SYSCALL_DEF(setsid);
#if !defined(SYSCALL_TABLE) || defined(TARGET_NR_semop)
diff --git a/linux-user/syscall-proc.inc.c b/linux-user/syscall-proc.inc.c
index 567df54581..b1a801fb62 100644
--- a/linux-user/syscall-proc.inc.c
+++ b/linux-user/syscall-proc.inc.c
@@ -438,6 +438,21 @@ SYSCALL_IMPL(fork)
}
#endif
+#ifdef TARGET_NR_gethostname
+SYSCALL_IMPL(gethostname)
+{
+ char *name = lock_user(VERIFY_WRITE, arg1, arg2, 0);
+ abi_long ret;
+
+ if (!name) {
+ return -TARGET_EFAULT;
+ }
+ ret = get_errno(gethostname(name, arg2));
+ unlock_user(name, arg1, arg2);
+ return ret;
+}
+#endif
+
SYSCALL_IMPL(getpgid)
{
return get_errno(getpgid(arg1));
@@ -485,6 +500,19 @@ SYSCALL_IMPL(nice)
}
#endif
+SYSCALL_IMPL(sethostname)
+{
+ void *p = lock_user_string(arg1);
+ abi_long ret;
+
+ if (!p) {
+ return -TARGET_EFAULT;
+ }
+ ret = get_errno(sethostname(p, arg2));
+ unlock_user(p, arg1, 0);
+ return ret;
+}
+
SYSCALL_IMPL(setpgid)
{
return get_errno(setpgid(arg1, arg2));
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index b8b18ac1de..6dd4196647 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4240,12 +4240,6 @@ static abi_long do_syscall1(void *cpu_env, int num,
abi_long arg1,
void *p;
switch(num) {
- case TARGET_NR_sethostname:
- if (!(p = lock_user_string(arg1)))
- return -TARGET_EFAULT;
- ret = get_errno(sethostname(p, arg2));
- unlock_user(p, arg1, 0);
- return ret;
#ifdef TARGET_NR_setrlimit
case TARGET_NR_setrlimit:
{
@@ -7078,19 +7072,6 @@ static abi_long do_syscall1(void *cpu_env, int num,
abi_long arg1,
return ret;
}
#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;
- }
- return ret;
- }
-#endif
#ifdef TARGET_NR_atomic_cmpxchg_32
case TARGET_NR_atomic_cmpxchg_32:
{
diff --git a/linux-user/strace.list b/linux-user/strace.list
index b1c2f7851e..361ceec853 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -244,9 +244,6 @@
#ifdef TARGET_NR_getgroups32
{ TARGET_NR_getgroups32, "getgroups32" , NULL, NULL, NULL },
#endif
-#ifdef TARGET_NR_gethostname
-{ TARGET_NR_gethostname, "gethostname" , NULL, NULL, NULL },
-#endif
#ifdef TARGET_NR_getitimer
{ TARGET_NR_getitimer, "getitimer" , NULL, NULL, NULL },
#endif
@@ -1025,9 +1022,6 @@
#ifdef TARGET_NR_sethae
{ TARGET_NR_sethae, "sethae" , NULL, NULL, NULL },
#endif
-#ifdef TARGET_NR_sethostname
-{ TARGET_NR_sethostname, "sethostname" , NULL, NULL, NULL },
-#endif
#ifdef TARGET_NR_setitimer
{ TARGET_NR_setitimer, "setitimer" , NULL, NULL, NULL },
#endif
--
2.17.1
- [Qemu-devel] [PATCH v7 53/74] linux-user: Split out chroot, (continued)
- [Qemu-devel] [PATCH v7 53/74] linux-user: Split out chroot, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 57/74] linux-user: Split out sgetmask, ssetmask, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 56/74] linux-user: Split out sigaction, rt_sigaction, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 58/74] linux-user: Split out sigprocmask, rt_sigprocmask, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 60/74] linux-user: Split out sigsuspend, rt_sigsuspend, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 55/74] linux-user: Split out getsid, setsid, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 47/74] linux-user: Split out ioctl, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 54/74] linux-user: Split out getpgid, getpgrp, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 52/74] linux-user: Split out umask, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 59/74] linux-user: Split out sigpending, rt_sigpending, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 64/74] linux-user: Split out gethostname, sethostname,
Richard Henderson <=
- [Qemu-devel] [PATCH v7 65/74] linux-user: Split out getrlimit, setrlimit, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 61/74] linux-user: Split out rt_sigtimedwait, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 62/74] linux-user: Split out rt_sigqueueinfo, rt_tgsigqueueinfo, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 63/74] linux-user: Split out sigreturn, rt_sigreturn, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 66/74] linux-user: Split out getrusage, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 67/74] linux-user: Split out gettimeofday, settimeofday, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 69/74] linux-user: Split out pselect6, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 68/74] linux-user: Split out select, _newselect, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 70/74] linux-user: Split out symlink, symlinkat, Richard Henderson, 2019/05/19