aboutsummaryrefslogtreecommitdiff
path: root/linux-user/syscall_defs.h
diff options
context:
space:
mode:
authorAleksandar Markovic <aleksandar.markovic@imgtec.com>2016-09-22 18:56:57 +0200
committerRiku Voipio <riku.voipio@linaro.org>2016-10-21 15:19:40 +0300
commitff71a4545c0d9b452e77a91ab1c46f79a10a9eca (patch)
tree1ef9e290fcfde01d191da39f12bfbd2f171b6195 /linux-user/syscall_defs.h
parentda39db63e4468e39bb56d04d191866c5276aa7fa (diff)
linux-user: Fix socketcall() syscall support
Since not all Linux host platforms support socketcall() (most notably Intel), do_socketcall() function in Qemu's syscalls.c is implemented to mirror the corespondant implementation of socketcall() in Linux kernel, and to utilise individual socket operations that are supported on all Linux platforms. (see kernel source file net/socket.c, definition of socketcall). However, error codes produced by Qemu implementation are wrong for the cases of invalid values of the first argument. Also, naming of constants is not consistent with kernel one, and not consistant with Qemu convention of prefixing such constants with "TARGET_". This patch in that light brings do_socketcall() closer to its kernel counterpart, and in that way fixes the errors and yields more consisrtent Qemu code. There were also three missing cases (among 20) for strace support for socketcall(). The array that contains pointers for appropriate printing functions is updated with 3 elements, however pointers to functions are left NULL, and its implementation is left for future. Also, this patch fixes failure of LTP test socketcall02, if executed on some Qemu emulated sywstems (uer mode). Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Diffstat (limited to 'linux-user/syscall_defs.h')
-rw-r--r--linux-user/syscall_defs.h42
1 files changed, 22 insertions, 20 deletions
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index ca8fa6ee91..e70977169f 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -9,26 +9,28 @@
#include "syscall_nr.h"
-#define SOCKOP_socket 1
-#define SOCKOP_bind 2
-#define SOCKOP_connect 3
-#define SOCKOP_listen 4
-#define SOCKOP_accept 5
-#define SOCKOP_getsockname 6
-#define SOCKOP_getpeername 7
-#define SOCKOP_socketpair 8
-#define SOCKOP_send 9
-#define SOCKOP_recv 10
-#define SOCKOP_sendto 11
-#define SOCKOP_recvfrom 12
-#define SOCKOP_shutdown 13
-#define SOCKOP_setsockopt 14
-#define SOCKOP_getsockopt 15
-#define SOCKOP_sendmsg 16
-#define SOCKOP_recvmsg 17
-#define SOCKOP_accept4 18
-#define SOCKOP_recvmmsg 19
-#define SOCKOP_sendmmsg 20
+
+/* socket operations for socketcall() */
+#define TARGET_SYS_SOCKET 1 /* socket() */
+#define TARGET_SYS_BIND 2 /* bind() */
+#define TARGET_SYS_CONNECT 3 /* connect() */
+#define TARGET_SYS_LISTEN 4 /* listen() */
+#define TARGET_SYS_ACCEPT 5 /* accept() */
+#define TARGET_SYS_GETSOCKNAME 6 /* getsockname() */
+#define TARGET_SYS_GETPEERNAME 7 /* getpeername() */
+#define TARGET_SYS_SOCKETPAIR 8 /* socketpair() */
+#define TARGET_SYS_SEND 9 /* send() */
+#define TARGET_SYS_RECV 10 /* recv() */
+#define TARGET_SYS_SENDTO 11 /* sendto() */
+#define TARGET_SYS_RECVFROM 12 /* recvfrom() */
+#define TARGET_SYS_SHUTDOWN 13 /* shutdown() */
+#define TARGET_SYS_SETSOCKOPT 14 /* setsockopt() */
+#define TARGET_SYS_GETSOCKOPT 15 /* getsockopt() */
+#define TARGET_SYS_SENDMSG 16 /* sendmsg() */
+#define TARGET_SYS_RECVMSG 17 /* recvmsg() */
+#define TARGET_SYS_ACCEPT4 18 /* accept4() */
+#define TARGET_SYS_RECVMMSG 19 /* recvmmsg() */
+#define TARGET_SYS_SENDMMSG 20 /* sendmmsg() */
#define IPCOP_semop 1
#define IPCOP_semget 2