diff mbox series

[v2,046/108] linux-user: Split out 7 syscalls

Message ID 20180610030220.3777-47-richard.henderson@linaro.org
State New
Headers show
Series linux-user: Split do_syscall | expand

Commit Message

Richard Henderson June 10, 2018, 3:01 a.m. UTC
Handle getpeername, getsockname, getsockopt,
listen, recv, recvfrom, recvmsg.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 linux-user/syscall.c | 98 +++++++++++++++++++++++++++++++-------------
 1 file changed, 70 insertions(+), 28 deletions(-)

-- 
2.17.1
diff mbox series

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 155da4f523..98a982f83f 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8153,6 +8153,13 @@  IMPL(futimesat)
 }
 #endif
 
+#ifdef TARGET_NR_getpeername
+IMPL(getpeername)
+{
+    return do_getpeername(arg1, arg2, arg3);
+}
+#endif
+
 #ifdef TARGET_NR_getpgrp
 IMPL(getpgrp)
 {
@@ -8226,6 +8233,20 @@  IMPL(getrusage)
     return ret;
 }
 
+#ifdef TARGET_NR_getsockname
+IMPL(getsockname)
+{
+    return do_getsockname(arg1, arg2, arg3);
+}
+#endif
+
+#ifdef TARGET_NR_getsockopt
+IMPL(getsockopt)
+{
+    return do_getsockopt(arg1, arg2, arg3, arg4, arg5);
+}
+#endif
+
 IMPL(gettimeofday)
 {
     struct timeval tv;
@@ -8374,6 +8395,13 @@  IMPL(linkat)
     return ret;
 }
 
+#ifdef TARGET_NR_listen
+IMPL(listen)
+{
+    return get_errno(listen(arg1, arg2));
+}
+#endif
+
 IMPL(lseek)
 {
     return get_errno(lseek(arg1, arg2, arg3));
@@ -8912,6 +8940,27 @@  IMPL(reboot)
     return ret;
 }
 
+#ifdef TARGET_NR_recv
+IMPL(recv)
+{
+    return do_recvfrom(arg1, arg2, arg3, arg4, 0, 0);
+}
+#endif
+
+#ifdef TARGET_NR_recvfrom
+IMPL(recvfrom)
+{
+    return do_recvfrom(arg1, arg2, arg3, arg4, arg5, arg6);
+}
+#endif
+
+#ifdef TARGET_NR_recvmsg
+IMPL(recvmsg)
+{
+    return do_sendrecvmsg(arg1, arg2, arg3, 0);
+}
+#endif
+
 #ifdef TARGET_NR_rename
 IMPL(rename)
 {
@@ -9951,34 +10000,6 @@  static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1,
     void *p;
 
     switch(num) {
-#ifdef TARGET_NR_getpeername
-    case TARGET_NR_getpeername:
-        return do_getpeername(arg1, arg2, arg3);
-#endif
-#ifdef TARGET_NR_getsockname
-    case TARGET_NR_getsockname:
-        return do_getsockname(arg1, arg2, arg3);
-#endif
-#ifdef TARGET_NR_getsockopt
-    case TARGET_NR_getsockopt:
-        return do_getsockopt(arg1, arg2, arg3, arg4, arg5);
-#endif
-#ifdef TARGET_NR_listen
-    case TARGET_NR_listen:
-        return get_errno(listen(arg1, arg2));
-#endif
-#ifdef TARGET_NR_recv
-    case TARGET_NR_recv:
-        return do_recvfrom(arg1, arg2, arg3, arg4, 0, 0);
-#endif
-#ifdef TARGET_NR_recvfrom
-    case TARGET_NR_recvfrom:
-        return do_recvfrom(arg1, arg2, arg3, arg4, arg5, arg6);
-#endif
-#ifdef TARGET_NR_recvmsg
-    case TARGET_NR_recvmsg:
-        return do_sendrecvmsg(arg1, arg2, arg3, 0);
-#endif
 #ifdef TARGET_NR_send
     case TARGET_NR_send:
         return do_sendto(arg1, arg2, arg3, arg4, 0, 0);
@@ -12827,6 +12848,9 @@  static impl_fn *syscall_table(unsigned num)
 #ifdef TARGET_NR_futimesat
         SYSCALL(futimesat);
 #endif
+#ifdef TARGET_NR_getpeername
+        SYSCALL(getpeername);
+#endif
 #ifdef TARGET_NR_getpgrp
         SYSCALL(getpgrp);
 #endif
@@ -12839,6 +12863,12 @@  static impl_fn *syscall_table(unsigned num)
         SYSCALL(getpriority);
         SYSCALL(getrlimit);
         SYSCALL(getrusage);
+#ifdef TARGET_NR_getsockname
+        SYSCALL(getsockname);
+#endif
+#ifdef TARGET_NR_getsockopt
+        SYSCALL(getsockopt);
+#endif
         SYSCALL(gettimeofday);
 #if defined(TARGET_NR_getxpid) && defined(TARGET_ALPHA)
         SYSCALL(getxpid);
@@ -12849,6 +12879,9 @@  static impl_fn *syscall_table(unsigned num)
         SYSCALL(link);
 #endif
         SYSCALL(linkat);
+#ifdef TARGET_NR_listen
+        SYSCALL(listen);
+#endif
         SYSCALL(lseek);
 #ifdef TARGET_NR_mkdir
         SYSCALL(mkdir);
@@ -12903,6 +12936,15 @@  static impl_fn *syscall_table(unsigned num)
 #endif
         SYSCALL(readlinkat);
         SYSCALL(reboot);
+#ifdef TARGET_NR_recv
+        SYSCALL(recv);
+#endif
+#ifdef TARGET_NR_recvfrom
+        SYSCALL(recvfrom);
+#endif
+#ifdef TARGET_NR_recvmsg
+        SYSCALL(recvmsg);
+#endif
 #ifdef TARGET_NR_rename
         SYSCALL(rename);
 #endif