* [Qemu-devel] [PATCH] mips-user socket-related syscall support
@ 2006-06-19 9:00 Raphaël Rigo
2006-06-19 22:03 ` Fabrice Bellard
2006-06-19 22:52 ` Fabrice Bellard
0 siblings, 2 replies; 8+ messages in thread
From: Raphaël Rigo @ 2006-06-19 9:00 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 705 bytes --]
Hello,
this patch is a revamped version of the one I posted about 2 months ago,
it is much better. It implements the syscalls related to sockets on the
MIPS platform (because it has no "socketcall" syscall). I had to create
a "socket.h" file defining the constants for the targets because MIPS
doesn't have the same as every other platform.
The calls implemented are : accept, bind, connect, getpeername,
getsockname, listen, recv, recvfrom, recvmsg, send, sendmsg, sendto,
shutdown, socket, socketpair.
Combined with the other patch I just posted (signal handling), qemu-mips
is now capable of running a webserver (which is very nice :)
Please consider it for inclusion into mainline.
Raphaël Rigo
[-- Attachment #2: mips-socket-syscalls.diff --]
[-- Type: text/plain, Size: 21235 bytes --]
? linux-user/sh4/socket.h
Index: linux-user/qemu.h
===================================================================
RCS file: /sources/qemu/qemu/linux-user/qemu.h,v
retrieving revision 1.28
diff -u -r1.28 qemu.h
--- linux-user/qemu.h 17 Jun 2006 18:30:42 -0000 1.28
+++ linux-user/qemu.h 19 Jun 2006 08:35:38 -0000
@@ -6,6 +6,7 @@
#include <signal.h>
#include <string.h>
#include "syscall_defs.h"
+#include "socket.h"
#include "cpu.h"
#include "syscall.h"
Index: linux-user/syscall.c
===================================================================
RCS file: /sources/qemu/qemu/linux-user/syscall.c,v
retrieving revision 1.72
diff -u -r1.72 syscall.c
--- linux-user/syscall.c 14 Jun 2006 13:36:59 -0000 1.72
+++ linux-user/syscall.c 19 Jun 2006 08:35:39 -0000
@@ -446,7 +446,7 @@
cmsg->cmsg_type = tswap32(target_cmsg->cmsg_type);
cmsg->cmsg_len = CMSG_LEN(len);
- if (cmsg->cmsg_level != SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS) {
+ if (cmsg->cmsg_level != TARGET_SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS) {
gemu_log("Unsupported ancillary data: %d/%d\n", cmsg->cmsg_level, cmsg->cmsg_type);
memcpy(data, target_data, len);
} else {
@@ -490,7 +490,7 @@
target_cmsg->cmsg_type = tswap32(cmsg->cmsg_type);
target_cmsg->cmsg_len = tswapl(TARGET_CMSG_LEN(len));
- if (cmsg->cmsg_level != SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS) {
+ if (cmsg->cmsg_level != TARGET_SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS) {
gemu_log("Unsupported ancillary data: %d/%d\n", cmsg->cmsg_level, cmsg->cmsg_type);
memcpy(target_data, data, len);
} else {
@@ -552,38 +552,74 @@
goto unimplemented;
}
break;
- case SOL_SOCKET:
+ case TARGET_SOL_SOCKET:
switch (optname) {
/* Options with 'int' argument. */
- case SO_DEBUG:
- case SO_REUSEADDR:
- case SO_TYPE:
- case SO_ERROR:
- case SO_DONTROUTE:
- case SO_BROADCAST:
- case SO_SNDBUF:
- case SO_RCVBUF:
- case SO_KEEPALIVE:
- case SO_OOBINLINE:
- case SO_NO_CHECK:
- case SO_PRIORITY:
+ case TARGET_SO_DEBUG:
+ optname = SO_DEBUG;
+ break;
+ case TARGET_SO_REUSEADDR:
+ optname = SO_REUSEADDR;
+ break;
+ case TARGET_SO_TYPE:
+ optname = SO_TYPE;
+ break;
+ case TARGET_SO_ERROR:
+ optname = SO_ERROR;
+ break;
+ case TARGET_SO_DONTROUTE:
+ optname = SO_DONTROUTE;
+ break;
+ case TARGET_SO_BROADCAST:
+ optname = SO_BROADCAST;
+ break;
+ case TARGET_SO_SNDBUF:
+ optname = SO_SNDBUF;
+ break;
+ case TARGET_SO_RCVBUF:
+ optname = SO_RCVBUF;
+ break;
+ case TARGET_SO_KEEPALIVE:
+ optname = SO_KEEPALIVE;
+ break;
+ case TARGET_SO_OOBINLINE:
+ optname = SO_OOBINLINE;
+ break;
+ case TARGET_SO_NO_CHECK:
+ optname = SO_NO_CHECK;
+ break;
+ case TARGET_SO_PRIORITY:
+ optname = SO_PRIORITY;
+ break;
#ifdef SO_BSDCOMPAT
- case SO_BSDCOMPAT:
+ case TARGET_SO_BSDCOMPAT:
+ optname = SO_BSDCOMPAT;
+ break;
#endif
- case SO_PASSCRED:
- case SO_TIMESTAMP:
- case SO_RCVLOWAT:
- case SO_RCVTIMEO:
- case SO_SNDTIMEO:
- if (optlen < sizeof(uint32_t))
- return -EINVAL;
-
- val = tget32(optval);
- ret = get_errno(setsockopt(sockfd, level, optname, &val, sizeof(val)));
+ case TARGET_SO_PASSCRED:
+ optname = SO_PASSCRED;
+ break;
+ case TARGET_SO_TIMESTAMP:
+ optname = SO_TIMESTAMP;
+ break;
+ case TARGET_SO_RCVLOWAT:
+ optname = SO_RCVLOWAT;
+ break;
+ case TARGET_SO_RCVTIMEO:
+ optname = SO_RCVTIMEO;
+ break;
+ case TARGET_SO_SNDTIMEO:
+ optname = SO_SNDTIMEO;
+ break;
break;
default:
goto unimplemented;
}
+ if (optlen < sizeof(uint32_t))
+ return -EINVAL;
+
+ val = tget32(optval);
+ ret = get_errno(setsockopt(sockfd, SOL_SOCKET, optname, &val, sizeof(val)));
break;
default:
unimplemented:
@@ -599,13 +635,14 @@
int len, lv, val, ret;
switch(level) {
- case SOL_SOCKET:
+ case TARGET_SOL_SOCKET:
+ level = SOL_SOCKET;
switch (optname) {
- case SO_LINGER:
- case SO_RCVTIMEO:
- case SO_SNDTIMEO:
- case SO_PEERCRED:
- case SO_PEERNAME:
+ case TARGET_SO_LINGER:
+ case TARGET_SO_RCVTIMEO:
+ case TARGET_SO_SNDTIMEO:
+ case TARGET_SO_PEERCRED:
+ case TARGET_SO_PEERNAME:
/* These don't just return a single integer */
goto unimplemented;
default:
@@ -723,6 +760,29 @@
int type = tgetl(vptr + n);
int protocol = tgetl(vptr + 2 * n);
+#if defined(TARGET_MIPS)
+ switch(type) {
+ case TARGET_SOCK_DGRAM:
+ type = SOCK_DGRAM;
+ break;
+ case TARGET_SOCK_STREAM:
+ type = SOCK_STREAM;
+ break;
+ case TARGET_SOCK_RAW:
+ type = SOCK_RAW;
+ break;
+ case TARGET_SOCK_RDM:
+ type = SOCK_RDM;
+ break;
+ case TARGET_SOCK_SEQPACKET:
+ type = SOCK_SEQPACKET;
+ break;
+ case TARGET_SOCK_PACKET:
+ type = SOCK_PACKET;
+ break;
+ }
+#endif
+
ret = get_errno(socket(domain, type, protocol));
}
break;
@@ -1773,6 +1833,14 @@
struct stat st;
struct statfs stfs;
void *p;
+ target_long args[6];
+
+ tputl(args, arg1);
+ tputl(args+1, arg2);
+ tputl(args+2, arg3);
+ tputl(args+3, arg4);
+ tputl(args+4, arg5);
+ tputl(args+5, arg6);
#ifdef DEBUG
gemu_log("syscall %d", num);
@@ -2611,6 +2679,104 @@
case TARGET_NR_socketcall:
ret = do_socketcall(arg1, arg2);
break;
+
+#ifdef TARGET_NR_accept
+ case TARGET_NR_accept:
+ ret = do_socketcall(SOCKOP_accept, (target_ulong)args);
+ break;
+#endif
+
+#ifdef TARGET_NR_bind
+ case TARGET_NR_bind:
+ ret = do_socketcall(SOCKOP_bind, (target_ulong)args);
+ break;
+#endif
+
+#ifdef TARGET_NR_connect
+ case TARGET_NR_connect:
+ ret = do_socketcall(SOCKOP_connect, (target_ulong)args);
+ break;
+#endif
+
+#ifdef TARGET_NR_getpeername
+ case TARGET_NR_getpeername:
+ ret = do_socketcall(SOCKOP_getpeername, (target_ulong)args);
+ break;
+#endif
+
+#ifdef TARGET_NR_getsockname
+ case TARGET_NR_getsockname:
+ ret = do_socketcall(SOCKOP_getsockname, (target_ulong)args);
+ break;
+#endif
+
+#ifdef TARGET_NR_listen
+ case TARGET_NR_listen:
+ ret = do_socketcall(SOCKOP_listen, (target_ulong)args);
+ break;
+#endif
+
+
+#ifdef TARGET_NR_recv
+ case TARGET_NR_recv:
+ ret = do_socketcall(SOCKOP_recv, (target_ulong)args);
+ break;
+#endif
+
+#ifdef TARGET_NR_recvfrom
+ case TARGET_NR_recvfrom:
+ ret = do_socketcall(SOCKOP_recvfrom, (target_ulong)args);
+ break;
+#endif
+
+#ifdef TARGET_NR_recvmsg
+ case TARGET_NR_recvmsg:
+ ret = do_socketcall(SOCKOP_recvmsg, (target_ulong)args);
+ break;
+#endif
+
+#ifdef TARGET_NR_send
+ case TARGET_NR_send:
+ ret = do_socketcall(SOCKOP_send, (target_ulong)args);
+ break;
+#endif
+
+#ifdef TARGET_NR_sendmsg
+ case TARGET_NR_sendmsg:
+ ret = do_socketcall(SOCKOP_sendmsg, (target_ulong)args);
+ break;
+#endif
+
+#ifdef TARGET_NR_sendto
+ case TARGET_NR_sendto:
+ ret = do_socketcall(SOCKOP_sendto, (target_ulong)args);
+ break;
+#endif
+
+#ifdef TARGET_NR_shutdown
+ case TARGET_NR_shutdown:
+ ret = do_socketcall(SOCKOP_shutdown, (target_ulong)args);
+ break;
+#endif
+
+#ifdef TARGET_NR_socket
+ case TARGET_NR_socket:
+ ret = do_socketcall(SOCKOP_socket, (target_ulong)args);
+ break;
+#endif
+
+#ifdef TARGET_NR_socketpair
+ case TARGET_NR_socketpair:
+ ret = do_socketcall(SOCKOP_socketpair, (target_ulong)args);
+ break;
+#endif
+
+#ifdef TARGET_NR_setsockopt
+ case TARGET_NR_setsockopt:
+ ret = do_setsockopt(arg1, arg2, arg3, arg4, (socklen_t) arg5);
+ break;
+#endif
+
case TARGET_NR_syslog:
goto unimplemented;
case TARGET_NR_setitimer:
Index: linux-user/arm/socket.h
===================================================================
RCS file: linux-user/arm/socket.h
diff -N linux-user/arm/socket.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ linux-user/arm/socket.h 19 Jun 2006 08:35:39 -0000
@@ -0,0 +1,45 @@
+/* For setsockopt(2) */
+#define TARGET_SOL_SOCKET 1
+
+#define TARGET_SO_DEBUG 1
+#define TARGET_SO_REUSEADDR 2
+#define TARGET_SO_TYPE 3
+#define TARGET_SO_ERROR 4
+#define TARGET_SO_DONTROUTE 5
+#define TARGET_SO_BROADCAST 6
+#define TARGET_SO_SNDBUF 7
+#define TARGET_SO_RCVBUF 8
+#define TARGET_SO_SNDBUFFORCE 32
+#define TARGET_SO_RCVBUFFORCE 33
+#define TARGET_SO_KEEPALIVE 9
+#define TARGET_SO_OOBINLINE 10
+#define TARGET_SO_NO_CHECK 11
+#define TARGET_SO_PRIORITY 12
+#define TARGET_SO_LINGER 13
+#define TARGET_SO_BSDCOMPAT 14
+/* To add :#define TARGET_SO_REUSEPORT 15 */
+#define TARGET_SO_PASSCRED 16
+#define TARGET_SO_PEERCRED 17
+#define TARGET_SO_RCVLOWAT 18
+#define TARGET_SO_SNDLOWAT 19
+#define TARGET_SO_RCVTIMEO 20
+#define TARGET_SO_SNDTIMEO 21
+
+/* Security levels - as per NRL IPv6 - don't actually do anything */
+#define TARGET_SO_SECURITY_AUTHENTICATION 22
+#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 23
+#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 24
+
+#define TARGET_SO_BINDTODEVICE 25
+
+/* Socket filtering */
+#define TARGET_SO_ATTACH_FILTER 26
+#define TARGET_SO_DETACH_FILTER 27
+
+#define TARGET_SO_PEERNAME 28
+#define TARGET_SO_TIMESTAMP 29
+#define TARGET_SCM_TIMESTAMP TARGET_SO_TIMESTAMP
+
+#define TARGET_SO_ACCEPTCONN 30
+
+#define TARGET_SO_PEERSEC 31
Index: linux-user/i386/socket.h
===================================================================
RCS file: linux-user/i386/socket.h
diff -N linux-user/i386/socket.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ linux-user/i386/socket.h 19 Jun 2006 08:35:39 -0000
@@ -0,0 +1,45 @@
+/* For setsockopt(2) */
+#define TARGET_SOL_SOCKET 1
+
+#define TARGET_SO_DEBUG 1
+#define TARGET_SO_REUSEADDR 2
+#define TARGET_SO_TYPE 3
+#define TARGET_SO_ERROR 4
+#define TARGET_SO_DONTROUTE 5
+#define TARGET_SO_BROADCAST 6
+#define TARGET_SO_SNDBUF 7
+#define TARGET_SO_RCVBUF 8
+#define TARGET_SO_SNDBUFFORCE 32
+#define TARGET_SO_RCVBUFFORCE 33
+#define TARGET_SO_KEEPALIVE 9
+#define TARGET_SO_OOBINLINE 10
+#define TARGET_SO_NO_CHECK 11
+#define TARGET_SO_PRIORITY 12
+#define TARGET_SO_LINGER 13
+#define TARGET_SO_BSDCOMPAT 14
+/* To add :#define TARGET_SO_REUSEPORT 15 */
+#define TARGET_SO_PASSCRED 16
+#define TARGET_SO_PEERCRED 17
+#define TARGET_SO_RCVLOWAT 18
+#define TARGET_SO_SNDLOWAT 19
+#define TARGET_SO_RCVTIMEO 20
+#define TARGET_SO_SNDTIMEO 21
+
+/* Security levels - as per NRL IPv6 - don't actually do anything */
+#define TARGET_SO_SECURITY_AUTHENTICATION 22
+#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 23
+#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 24
+
+#define TARGET_SO_BINDTODEVICE 25
+
+/* Socket filtering */
+#define TARGET_SO_ATTACH_FILTER 26
+#define TARGET_SO_DETACH_FILTER 27
+
+#define TARGET_SO_PEERNAME 28
+#define TARGET_SO_TIMESTAMP 29
+#define TARGET_SCM_TIMESTAMP TARGET_SO_TIMESTAMP
+
+#define TARGET_SO_ACCEPTCONN 30
+
+#define TARGET_SO_PEERSEC 31
Index: linux-user/mips/socket.h
===================================================================
RCS file: linux-user/mips/socket.h
diff -N linux-user/mips/socket.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ linux-user/mips/socket.h 19 Jun 2006 08:35:39 -0000
@@ -0,0 +1,87 @@
+
+/*
+ * For setsockopt(2)
+ *
+ * This defines are ABI conformant as far as Linux supports these ...
+ */
+#define TARGET_SOL_SOCKET 0xffff
+
+#define TARGET_SO_DEBUG 0x0001 /* Record debugging information. */
+#define TARGET_SO_REUSEADDR 0x0004 /* Allow reuse of local addresses. */
+#define TARGET_SO_KEEPALIVE 0x0008 /* Keep connections alive and send
+ SIGPIPE when they die. */
+#define TARGET_SO_DONTROUTE 0x0010 /* Don't do local routing. */
+#define TARGET_SO_BROADCAST 0x0020 /* Allow transmission of
+ broadcast messages. */
+#define TARGET_SO_LINGER 0x0080 /* Block on close of a reliable
+ socket to transmit pending data. */
+#define TARGET_SO_OOBINLINE 0x0100 /* Receive out-of-band data in-band. */
+#if 0
+To add: #define TARGET_SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */
+#endif
+
+#define TARGET_SO_TYPE 0x1008 /* Compatible name for SO_STYLE. */
+#define TARGET_SO_STYLE SO_TYPE /* Synonym */
+#define TARGET_SO_ERROR 0x1007 /* get error status and clear */
+#define TARGET_SO_SNDBUF 0x1001 /* Send buffer size. */
+#define TARGET_SO_RCVBUF 0x1002 /* Receive buffer. */
+#define TARGET_SO_SNDLOWAT 0x1003 /* send low-water mark */
+#define TARGET_SO_RCVLOWAT 0x1004 /* receive low-water mark */
+#define TARGET_SO_SNDTIMEO 0x1005 /* send timeout */
+#define TARGET_SO_RCVTIMEO 0x1006 /* receive timeout */
+#define TARGET_SO_ACCEPTCONN 0x1009
+
+/* linux-specific, might as well be the same as on i386 */
+#define TARGET_SO_NO_CHECK 11
+#define TARGET_SO_PRIORITY 12
+#define TARGET_SO_BSDCOMPAT 14
+
+#define TARGET_SO_PASSCRED 17
+#define TARGET_SO_PEERCRED 18
+
+/* Security levels - as per NRL IPv6 - don't actually do anything */
+#define TARGET_SO_SECURITY_AUTHENTICATION 22
+#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 23
+#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 24
+
+#define TARGET_SO_BINDTODEVICE 25
+
+/* Socket filtering */
+#define TARGET_SO_ATTACH_FILTER 26
+#define TARGET_SO_DETACH_FILTER 27
+
+#define TARGET_SO_PEERNAME 28
+#define TARGET_SO_TIMESTAMP 29
+#define SCM_TIMESTAMP SO_TIMESTAMP
+
+#define TARGET_SO_PEERSEC 30
+#define TARGET_SO_SNDBUFFORCE 31
+#define TARGET_SO_RCVBUFFORCE 33
+
+/** sock_type - Socket types
+ *
+ * Please notice that for binary compat reasons MIPS has to
+ * override the enum sock_type in include/linux/net.h, so
+ * we define ARCH_HAS_SOCKET_TYPES here.
+ *
+ * @SOCK_DGRAM - datagram (conn.less) socket
+ * @SOCK_STREAM - stream (connection) socket
+ * @SOCK_RAW - raw socket
+ * @SOCK_RDM - reliably-delivered message
+ * @SOCK_SEQPACKET - sequential packet socket
+ * @SOCK_PACKET - linux specific way of getting packets at the dev level.
+ * For writing rarp and other similar things on the user level.
+ */
+enum sock_type {
+ TARGET_SOCK_DGRAM = 1,
+ TARGET_SOCK_STREAM = 2,
+ TARGET_SOCK_RAW = 3,
+ TARGET_SOCK_RDM = 4,
+ TARGET_SOCK_SEQPACKET = 5,
+ TARGET_SOCK_DCCP = 6,
+ TARGET_SOCK_PACKET = 10,
+};
+
+#define TARGET_SOCK_MAX (SOCK_PACKET + 1)
+
+
Index: linux-user/ppc/socket.h
===================================================================
RCS file: linux-user/ppc/socket.h
diff -N linux-user/ppc/socket.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ linux-user/ppc/socket.h 19 Jun 2006 08:35:39 -0000
@@ -0,0 +1,45 @@
+
+#define TARGET_SOL_SOCKET 1
+
+#define TARGET_SO_DEBUG 1
+#define TARGET_SO_REUSEADDR 2
+#define TARGET_SO_TYPE 3
+#define TARGET_SO_ERROR 4
+#define TARGET_SO_DONTROUTE 5
+#define TARGET_SO_BROADCAST 6
+#define TARGET_SO_SNDBUF 7
+#define TARGET_SO_RCVBUF 8
+#define TARGET_SO_SNDBUFFORCE 32
+#define TARGET_SO_RCVBUFFORCE 33
+#define TARGET_SO_KEEPALIVE 9
+#define TARGET_SO_OOBINLINE 10
+#define TARGET_SO_NO_CHECK 11
+#define TARGET_SO_PRIORITY 12
+#define TARGET_SO_LINGER 13
+#define TARGET_SO_BSDCOMPAT 14
+/* To add :#define TARGET_SO_REUSEPORT 15 */
+#define TARGET_SO_RCVLOWAT 16
+#define TARGET_SO_SNDLOWAT 17
+#define TARGET_SO_RCVTIMEO 18
+#define TARGET_SO_SNDTIMEO 19
+#define TARGET_SO_PASSCRED 20
+#define TARGET_SO_PEERCRED 21
+
+/* Security levels - as per NRL IPv6 - don't actually do anything */
+#define TARGET_SO_SECURITY_AUTHENTICATION 22
+#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 23
+#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 24
+
+#define TARGET_SO_BINDTODEVICE 25
+
+/* Socket filtering */
+#define TARGET_SO_ATTACH_FILTER 26
+#define TARGET_SO_DETACH_FILTER 27
+
+#define TARGET_SO_PEERNAME 28
+#define TARGET_SO_TIMESTAMP 29
+#define TARGET_SCM_TIMESTAMP TARGET_SO_TIMESTAMP
+
+#define TARGET_SO_ACCEPTCONN 30
+
+#define TARGET_SO_PEERSEC 31
Index: linux-user/sparc/socket.h
===================================================================
RCS file: linux-user/sparc/socket.h
diff -N linux-user/sparc/socket.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ linux-user/sparc/socket.h 19 Jun 2006 08:35:40 -0000
@@ -0,0 +1,49 @@
+/* For setsockopt(2) */
+#define TARGET_SOL_SOCKET 0xffff
+
+#define TARGET_SO_DEBUG 0x0001
+#define TARGET_SO_PASSCRED 0x0002
+#define TARGET_SO_REUSEADDR 0x0004
+#define TARGET_SO_KEEPALIVE 0x0008
+#define TARGET_SO_DONTROUTE 0x0010
+#define TARGET_SO_BROADCAST 0x0020
+#define TARGET_SO_PEERCRED 0x0040
+#define TARGET_SO_LINGER 0x0080
+#define TARGET_SO_OOBINLINE 0x0100
+/* To add :#define TARGET_SO_REUSEPORT 0x0200 */
+#define TARGET_SO_BSDCOMPAT 0x0400
+#define TARGET_SO_RCVLOWAT 0x0800
+#define TARGET_SO_SNDLOWAT 0x1000
+#define TARGET_SO_RCVTIMEO 0x2000
+#define TARGET_SO_SNDTIMEO 0x4000
+#define TARGET_SO_ACCEPTCONN 0x8000
+
+/* wha!??? */
+#define TARGET_SO_DONTLINGER (~SO_LINGER) /* Older SunOS compat. hack */
+
+#define TARGET_SO_SNDBUF 0x1001
+#define TARGET_SO_RCVBUF 0x1002
+#define TARGET_SO_SNDBUFFORCE 0x100a
+#define TARGET_SO_RCVBUFFORCE 0x100b
+#define TARGET_SO_ERROR 0x1007
+#define TARGET_SO_TYPE 0x1008
+
+/* Linux specific, keep the same. */
+#define TARGET_SO_NO_CHECK 0x000b
+#define TARGET_SO_PRIORITY 0x000c
+
+#define TARGET_SO_BINDTODEVICE 0x000d
+
+#define TARGET_SO_ATTACH_FILTER 0x001a
+#define TARGET_SO_DETACH_FILTER 0x001b
+
+#define TARGET_SO_PEERNAME 0x001c
+#define TARGET_SO_TIMESTAMP 0x001d
+#define TARGET_SCM_TIMESTAMP TARGET_SO_TIMESTAMP
+
+#define TARGET_SO_PEERSEC 0x100e
+
+/* Security levels - as per NRL IPv6 - don't actually do anything */
+#define TARGET_SO_SECURITY_AUTHENTICATION 0x5001
+#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002
+#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 0x5004
Index: linux-user/sparc64/socket.h
===================================================================
RCS file: linux-user/sparc64/socket.h
diff -N linux-user/sparc64/socket.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ linux-user/sparc64/socket.h 19 Jun 2006 08:35:40 -0000
@@ -0,0 +1,49 @@
+/* For setsockopt(2) */
+#define TARGET_SOL_SOCKET 0xffff
+
+#define TARGET_SO_DEBUG 0x0001
+#define TARGET_SO_PASSCRED 0x0002
+#define TARGET_SO_REUSEADDR 0x0004
+#define TARGET_SO_KEEPALIVE 0x0008
+#define TARGET_SO_DONTROUTE 0x0010
+#define TARGET_SO_BROADCAST 0x0020
+#define TARGET_SO_PEERCRED 0x0040
+#define TARGET_SO_LINGER 0x0080
+#define TARGET_SO_OOBINLINE 0x0100
+/* To add :#define TARGET_SO_REUSEPORT 0x0200 */
+#define TARGET_SO_BSDCOMPAT 0x0400
+#define TARGET_SO_RCVLOWAT 0x0800
+#define TARGET_SO_SNDLOWAT 0x1000
+#define TARGET_SO_RCVTIMEO 0x2000
+#define TARGET_SO_SNDTIMEO 0x4000
+#define TARGET_SO_ACCEPTCONN 0x8000
+
+/* wha!??? */
+#define TARGET_SO_DONTLINGER (~SO_LINGER) /* Older SunOS compat. hack */
+
+#define TARGET_SO_SNDBUF 0x1001
+#define TARGET_SO_RCVBUF 0x1002
+#define TARGET_SO_SNDBUFFORCE 0x100a
+#define TARGET_SO_RCVBUFFORCE 0x100b
+#define TARGET_SO_ERROR 0x1007
+#define TARGET_SO_TYPE 0x1008
+
+/* Linux specific, keep the same. */
+#define TARGET_SO_NO_CHECK 0x000b
+#define TARGET_SO_PRIORITY 0x000c
+
+#define TARGET_SO_BINDTODEVICE 0x000d
+
+#define TARGET_SO_ATTACH_FILTER 0x001a
+#define TARGET_SO_DETACH_FILTER 0x001b
+
+#define TARGET_SO_PEERNAME 0x001c
+#define TARGET_SO_TIMESTAMP 0x001d
+#define TARGET_SCM_TIMESTAMP TARGET_SO_TIMESTAMP
+
+#define TARGET_SO_PEERSEC 0x001e
+
+/* Security levels - as per NRL IPv6 - don't actually do anything */
+#define TARGET_SO_SECURITY_AUTHENTICATION 0x5001
+#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002
+#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 0x5004
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] mips-user socket-related syscall support
2006-06-19 9:00 [Qemu-devel] [PATCH] mips-user socket-related syscall support Raphaël Rigo
@ 2006-06-19 22:03 ` Fabrice Bellard
2006-06-20 6:54 ` Raphaël Rigo
2006-06-19 22:52 ` Fabrice Bellard
1 sibling, 1 reply; 8+ messages in thread
From: Fabrice Bellard @ 2006-06-19 22:03 UTC (permalink / raw)
To: ml-qemu; +Cc: qemu-devel
Hi,
Is it really needed to duplicate socket.h ? What are the differences for
mips ?
Regards,
Fabrice.
Raphaël Rigo wrote:
> Hello,
> this patch is a revamped version of the one I posted about 2 months ago,
> it is much better. It implements the syscalls related to sockets on the
> MIPS platform (because it has no "socketcall" syscall). I had to create
> a "socket.h" file defining the constants for the targets because MIPS
> doesn't have the same as every other platform.
>
> The calls implemented are : accept, bind, connect, getpeername,
> getsockname, listen, recv, recvfrom, recvmsg, send, sendmsg, sendto,
> shutdown, socket, socketpair.
>
> Combined with the other patch I just posted (signal handling), qemu-mips
> is now capable of running a webserver (which is very nice :)
>
> Please consider it for inclusion into mainline.
>
> Raphaël Rigo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] mips-user socket-related syscall support
2006-06-19 9:00 [Qemu-devel] [PATCH] mips-user socket-related syscall support Raphaël Rigo
2006-06-19 22:03 ` Fabrice Bellard
@ 2006-06-19 22:52 ` Fabrice Bellard
2006-06-20 8:47 ` Raphaël Rigo
1 sibling, 1 reply; 8+ messages in thread
From: Fabrice Bellard @ 2006-06-19 22:52 UTC (permalink / raw)
To: ml-qemu; +Cc: qemu-devel
Another point is that doing:
+ target_long args[6];
+
+ tputl(args, arg1);
+ tputl(args+1, arg2);
+ tputl(args+2, arg3);
+ tputl(args+3, arg4);
+ tputl(args+4, arg5);
+ tputl(args+5, arg6);
at the start of every syscall is not acceptable. You should add a
specific socket call wrapper which takes arg1... arg6 as arguments.
Regards,
Fabrice.
Raphaël Rigo wrote:
> Hello,
> this patch is a revamped version of the one I posted about 2 months ago,
> it is much better. It implements the syscalls related to sockets on the
> MIPS platform (because it has no "socketcall" syscall). I had to create
> a "socket.h" file defining the constants for the targets because MIPS
> doesn't have the same as every other platform.
>
> The calls implemented are : accept, bind, connect, getpeername,
> getsockname, listen, recv, recvfrom, recvmsg, send, sendmsg, sendto,
> shutdown, socket, socketpair.
>
> Combined with the other patch I just posted (signal handling), qemu-mips
> is now capable of running a webserver (which is very nice :)
>
> Please consider it for inclusion into mainline.
>
> Raphaël Rigo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] mips-user socket-related syscall support
2006-06-19 22:03 ` Fabrice Bellard
@ 2006-06-20 6:54 ` Raphaël Rigo
2006-06-20 8:28 ` Thiemo Seufer
0 siblings, 1 reply; 8+ messages in thread
From: Raphaël Rigo @ 2006-06-20 6:54 UTC (permalink / raw)
To: Fabrice Bellard; +Cc: qemu-devel
Fabrice Bellard wrote:
> Hi,
>
> Is it really needed to duplicate socket.h ? What are the differences for
> mips ?
>
> Regards,
>
> Fabrice.
>
Hi,
almost all socket related constants are different on MIPS. I thought it would be
cleaner to define all constants for each target, so that if we add support for
another platform with different constants, it will be easy.
Raphaël
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] mips-user socket-related syscall support
2006-06-20 6:54 ` Raphaël Rigo
@ 2006-06-20 8:28 ` Thiemo Seufer
0 siblings, 0 replies; 8+ messages in thread
From: Thiemo Seufer @ 2006-06-20 8:28 UTC (permalink / raw)
To: qemu-devel
Raphaël Rigo wrote:
> Fabrice Bellard wrote:
> > Hi,
> >
> > Is it really needed to duplicate socket.h ? What are the differences for
> > mips ?
> >
> > Regards,
> >
> > Fabrice.
> >
> Hi,
> almost all socket related constants are different on MIPS. I thought it would be
> cleaner to define all constants for each target, so that if we add support for
> another platform with different constants, it will be easy.
Historically Linux/MIPS followed MIPS Inc.'s RiscOS numbering scheme,
this explains most of the seemingly deliberate deviations from i386.
Thiemo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] mips-user socket-related syscall support
2006-06-19 22:52 ` Fabrice Bellard
@ 2006-06-20 8:47 ` Raphaël Rigo
2006-06-22 17:14 ` Raphaël Rigo
0 siblings, 1 reply; 8+ messages in thread
From: Raphaël Rigo @ 2006-06-20 8:47 UTC (permalink / raw)
To: Fabrice Bellard; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 514 bytes --]
Fabrice Bellard wrote:
> Another point is that doing:
>
> + target_long args[6];
> +
> + tputl(args, arg1);
> + tputl(args+1, arg2);
> + tputl(args+2, arg3);
> + tputl(args+3, arg4);
> + tputl(args+4, arg5);
> + tputl(args+5, arg6);
>
> at the start of every syscall is not acceptable. You should add a
> specific socket call wrapper which takes arg1... arg6 as arguments.
>
> Regards,
>
> Fabrice.
Thanks for reviewing it, the new attached version should be much cleaner.
Regards,
Raphaël
[-- Attachment #2: mips-socket-syscalls2.diff --]
[-- Type: text/plain, Size: 13868 bytes --]
Index: linux-user/qemu.h
===================================================================
RCS file: /sources/qemu/qemu/linux-user/qemu.h,v
retrieving revision 1.28
diff -u -r1.28 qemu.h
--- linux-user/qemu.h 17 Jun 2006 18:30:42 -0000 1.28
+++ linux-user/qemu.h 20 Jun 2006 08:46:54 -0000
@@ -6,6 +6,7 @@
#include <signal.h>
#include <string.h>
#include "syscall_defs.h"
+#include "socket.h"
#include "cpu.h"
#include "syscall.h"
Index: linux-user/socket.h
===================================================================
RCS file: linux-user/socket.h
diff -N linux-user/socket.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ linux-user/socket.h 20 Jun 2006 08:46:55 -0000
@@ -0,0 +1,138 @@
+
+#if defined(TARGET_MIPS)
+ // MIPS special values for constants
+
+ /*
+ * For setsockopt(2)
+ *
+ * This defines are ABI conformant as far as Linux supports these ...
+ */
+ #define TARGET_SOL_SOCKET 0xffff
+
+ #define TARGET_SO_DEBUG 0x0001 /* Record debugging information. */
+ #define TARGET_SO_REUSEADDR 0x0004 /* Allow reuse of local addresses. */
+ #define TARGET_SO_KEEPALIVE 0x0008 /* Keep connections alive and send
+ SIGPIPE when they die. */
+ #define TARGET_SO_DONTROUTE 0x0010 /* Don't do local routing. */
+ #define TARGET_SO_BROADCAST 0x0020 /* Allow transmission of
+ broadcast messages. */
+ #define TARGET_SO_LINGER 0x0080 /* Block on close of a reliable
+ socket to transmit pending data. */
+ #define TARGET_SO_OOBINLINE 0x0100 /* Receive out-of-band data in-band. */
+ #if 0
+ To add: #define TARGET_SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */
+ #endif
+
+ #define TARGET_SO_TYPE 0x1008 /* Compatible name for SO_STYLE. */
+ #define TARGET_SO_STYLE SO_TYPE /* Synonym */
+ #define TARGET_SO_ERROR 0x1007 /* get error status and clear */
+ #define TARGET_SO_SNDBUF 0x1001 /* Send buffer size. */
+ #define TARGET_SO_RCVBUF 0x1002 /* Receive buffer. */
+ #define TARGET_SO_SNDLOWAT 0x1003 /* send low-water mark */
+ #define TARGET_SO_RCVLOWAT 0x1004 /* receive low-water mark */
+ #define TARGET_SO_SNDTIMEO 0x1005 /* send timeout */
+ #define TARGET_SO_RCVTIMEO 0x1006 /* receive timeout */
+ #define TARGET_SO_ACCEPTCONN 0x1009
+
+ /* linux-specific, might as well be the same as on i386 */
+ #define TARGET_SO_NO_CHECK 11
+ #define TARGET_SO_PRIORITY 12
+ #define TARGET_SO_BSDCOMPAT 14
+
+ #define TARGET_SO_PASSCRED 17
+ #define TARGET_SO_PEERCRED 18
+
+ /* Security levels - as per NRL IPv6 - don't actually do anything */
+ #define TARGET_SO_SECURITY_AUTHENTICATION 22
+ #define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 23
+ #define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 24
+
+ #define TARGET_SO_BINDTODEVICE 25
+
+ /* Socket filtering */
+ #define TARGET_SO_ATTACH_FILTER 26
+ #define TARGET_SO_DETACH_FILTER 27
+
+ #define TARGET_SO_PEERNAME 28
+ #define TARGET_SO_TIMESTAMP 29
+ #define SCM_TIMESTAMP SO_TIMESTAMP
+
+ #define TARGET_SO_PEERSEC 30
+ #define TARGET_SO_SNDBUFFORCE 31
+ #define TARGET_SO_RCVBUFFORCE 33
+
+ /** sock_type - Socket types
+ *
+ * Please notice that for binary compat reasons MIPS has to
+ * override the enum sock_type in include/linux/net.h, so
+ * we define ARCH_HAS_SOCKET_TYPES here.
+ *
+ * @SOCK_DGRAM - datagram (conn.less) socket
+ * @SOCK_STREAM - stream (connection) socket
+ * @SOCK_RAW - raw socket
+ * @SOCK_RDM - reliably-delivered message
+ * @SOCK_SEQPACKET - sequential packet socket
+ * @SOCK_PACKET - linux specific way of getting packets at the dev level.
+ * For writing rarp and other similar things on the user level.
+ */
+ enum sock_type {
+ TARGET_SOCK_DGRAM = 1,
+ TARGET_SOCK_STREAM = 2,
+ TARGET_SOCK_RAW = 3,
+ TARGET_SOCK_RDM = 4,
+ TARGET_SOCK_SEQPACKET = 5,
+ TARGET_SOCK_DCCP = 6,
+ TARGET_SOCK_PACKET = 10,
+ };
+
+ #define TARGET_SOCK_MAX (SOCK_PACKET + 1)
+
+#else
+
+ /* For setsockopt(2) */
+ #define TARGET_SOL_SOCKET 1
+
+ #define TARGET_SO_DEBUG 1
+ #define TARGET_SO_REUSEADDR 2
+ #define TARGET_SO_TYPE 3
+ #define TARGET_SO_ERROR 4
+ #define TARGET_SO_DONTROUTE 5
+ #define TARGET_SO_BROADCAST 6
+ #define TARGET_SO_SNDBUF 7
+ #define TARGET_SO_RCVBUF 8
+ #define TARGET_SO_SNDBUFFORCE 32
+ #define TARGET_SO_RCVBUFFORCE 33
+ #define TARGET_SO_KEEPALIVE 9
+ #define TARGET_SO_OOBINLINE 10
+ #define TARGET_SO_NO_CHECK 11
+ #define TARGET_SO_PRIORITY 12
+ #define TARGET_SO_LINGER 13
+ #define TARGET_SO_BSDCOMPAT 14
+ /* To add :#define TARGET_SO_REUSEPORT 15 */
+ #define TARGET_SO_PASSCRED 16
+ #define TARGET_SO_PEERCRED 17
+ #define TARGET_SO_RCVLOWAT 18
+ #define TARGET_SO_SNDLOWAT 19
+ #define TARGET_SO_RCVTIMEO 20
+ #define TARGET_SO_SNDTIMEO 21
+
+ /* Security levels - as per NRL IPv6 - don't actually do anything */
+ #define TARGET_SO_SECURITY_AUTHENTICATION 22
+ #define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 23
+ #define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 24
+
+ #define TARGET_SO_BINDTODEVICE 25
+
+ /* Socket filtering */
+ #define TARGET_SO_ATTACH_FILTER 26
+ #define TARGET_SO_DETACH_FILTER 27
+
+ #define TARGET_SO_PEERNAME 28
+ #define TARGET_SO_TIMESTAMP 29
+ #define TARGET_SCM_TIMESTAMP TARGET_SO_TIMESTAMP
+
+ #define TARGET_SO_ACCEPTCONN 30
+
+ #define TARGET_SO_PEERSEC 31
+
+#endif
Index: linux-user/syscall.c
===================================================================
RCS file: /sources/qemu/qemu/linux-user/syscall.c,v
retrieving revision 1.72
diff -u -r1.72 syscall.c
--- linux-user/syscall.c 14 Jun 2006 13:36:59 -0000 1.72
+++ linux-user/syscall.c 20 Jun 2006 08:46:55 -0000
@@ -446,7 +446,7 @@
cmsg->cmsg_type = tswap32(target_cmsg->cmsg_type);
cmsg->cmsg_len = CMSG_LEN(len);
- if (cmsg->cmsg_level != SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS) {
+ if (cmsg->cmsg_level != TARGET_SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS) {
gemu_log("Unsupported ancillary data: %d/%d\n", cmsg->cmsg_level, cmsg->cmsg_type);
memcpy(data, target_data, len);
} else {
@@ -490,7 +490,7 @@
target_cmsg->cmsg_type = tswap32(cmsg->cmsg_type);
target_cmsg->cmsg_len = tswapl(TARGET_CMSG_LEN(len));
- if (cmsg->cmsg_level != SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS) {
+ if (cmsg->cmsg_level != TARGET_SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS) {
gemu_log("Unsupported ancillary data: %d/%d\n", cmsg->cmsg_level, cmsg->cmsg_type);
memcpy(target_data, data, len);
} else {
@@ -552,38 +552,74 @@
goto unimplemented;
}
break;
- case SOL_SOCKET:
+ case TARGET_SOL_SOCKET:
switch (optname) {
/* Options with 'int' argument. */
- case SO_DEBUG:
- case SO_REUSEADDR:
- case SO_TYPE:
- case SO_ERROR:
- case SO_DONTROUTE:
- case SO_BROADCAST:
- case SO_SNDBUF:
- case SO_RCVBUF:
- case SO_KEEPALIVE:
- case SO_OOBINLINE:
- case SO_NO_CHECK:
- case SO_PRIORITY:
+ case TARGET_SO_DEBUG:
+ optname = SO_DEBUG;
+ break;
+ case TARGET_SO_REUSEADDR:
+ optname = SO_REUSEADDR;
+ break;
+ case TARGET_SO_TYPE:
+ optname = SO_TYPE;
+ break;
+ case TARGET_SO_ERROR:
+ optname = SO_ERROR;
+ break;
+ case TARGET_SO_DONTROUTE:
+ optname = SO_DONTROUTE;
+ break;
+ case TARGET_SO_BROADCAST:
+ optname = SO_BROADCAST;
+ break;
+ case TARGET_SO_SNDBUF:
+ optname = SO_SNDBUF;
+ break;
+ case TARGET_SO_RCVBUF:
+ optname = SO_RCVBUF;
+ break;
+ case TARGET_SO_KEEPALIVE:
+ optname = SO_KEEPALIVE;
+ break;
+ case TARGET_SO_OOBINLINE:
+ optname = SO_OOBINLINE;
+ break;
+ case TARGET_SO_NO_CHECK:
+ optname = SO_NO_CHECK;
+ break;
+ case TARGET_SO_PRIORITY:
+ optname = SO_PRIORITY;
+ break;
#ifdef SO_BSDCOMPAT
- case SO_BSDCOMPAT:
+ case TARGET_SO_BSDCOMPAT:
+ optname = SO_BSDCOMPAT;
+ break;
#endif
- case SO_PASSCRED:
- case SO_TIMESTAMP:
- case SO_RCVLOWAT:
- case SO_RCVTIMEO:
- case SO_SNDTIMEO:
- if (optlen < sizeof(uint32_t))
- return -EINVAL;
-
- val = tget32(optval);
- ret = get_errno(setsockopt(sockfd, level, optname, &val, sizeof(val)));
+ case TARGET_SO_PASSCRED:
+ optname = SO_PASSCRED;
+ break;
+ case TARGET_SO_TIMESTAMP:
+ optname = SO_TIMESTAMP;
+ break;
+ case TARGET_SO_RCVLOWAT:
+ optname = SO_RCVLOWAT;
+ break;
+ case TARGET_SO_RCVTIMEO:
+ optname = SO_RCVTIMEO;
+ break;
+ case TARGET_SO_SNDTIMEO:
+ optname = SO_SNDTIMEO;
+ break;
break;
default:
goto unimplemented;
}
+ if (optlen < sizeof(uint32_t))
+ return -EINVAL;
+
+ val = tget32(optval);
+ ret = get_errno(setsockopt(sockfd, SOL_SOCKET, optname, &val, sizeof(val)));
break;
default:
unimplemented:
@@ -599,13 +635,14 @@
int len, lv, val, ret;
switch(level) {
- case SOL_SOCKET:
+ case TARGET_SOL_SOCKET:
+ level = SOL_SOCKET;
switch (optname) {
- case SO_LINGER:
- case SO_RCVTIMEO:
- case SO_SNDTIMEO:
- case SO_PEERCRED:
- case SO_PEERNAME:
+ case TARGET_SO_LINGER:
+ case TARGET_SO_RCVTIMEO:
+ case TARGET_SO_SNDTIMEO:
+ case TARGET_SO_PEERCRED:
+ case TARGET_SO_PEERNAME:
/* These don't just return a single integer */
goto unimplemented;
default:
@@ -723,6 +760,29 @@
int type = tgetl(vptr + n);
int protocol = tgetl(vptr + 2 * n);
+#if defined(TARGET_MIPS)
+ switch(type) {
+ case TARGET_SOCK_DGRAM:
+ type = SOCK_DGRAM;
+ break;
+ case TARGET_SOCK_STREAM:
+ type = SOCK_STREAM;
+ break;
+ case TARGET_SOCK_RAW:
+ type = SOCK_RAW;
+ break;
+ case TARGET_SOCK_RDM:
+ type = SOCK_RDM;
+ break;
+ case TARGET_SOCK_SEQPACKET:
+ type = SOCK_SEQPACKET;
+ break;
+ case TARGET_SOCK_PACKET:
+ type = SOCK_PACKET;
+ break;
+ }
+#endif
+
ret = get_errno(socket(domain, type, protocol));
}
break;
@@ -968,6 +1028,21 @@
}
+static long do_socketcallwrapper(int num, long arg1, long arg2, long arg3,
+ long arg4, long arg5, long arg6)
+{
+ target_long args[6];
+
+ tputl(args, arg1);
+ tputl(args+1, arg2);
+ tputl(args+2, arg3);
+ tputl(args+3, arg4);
+ tputl(args+4, arg5);
+ tputl(args+5, arg6);
+
+ return do_socketcall(num, (target_ulong) args);
+}
+
#define N_SHM_REGIONS 32
static struct shm_region {
@@ -2611,6 +2686,104 @@
case TARGET_NR_socketcall:
ret = do_socketcall(arg1, arg2);
break;
+
+#ifdef TARGET_NR_accept
+ case TARGET_NR_accept:
+ ret = do_socketcallwrapper(SOCKOP_accept, arg1, arg2, arg3, arg4, arg5, arg6);
+ break;
+#endif
+
+#ifdef TARGET_NR_bind
+ case TARGET_NR_bind:
+ ret = do_socketcallwrapper(SOCKOP_bind, arg1, arg2, arg3, arg4, arg5, arg6);
+ break;
+#endif
+
+#ifdef TARGET_NR_connect
+ case TARGET_NR_connect:
+ ret = do_socketcallwrapper(SOCKOP_connect, arg1, arg2, arg3, arg4, arg5, arg6);
+ break;
+#endif
+
+#ifdef TARGET_NR_getpeername
+ case TARGET_NR_getpeername:
+ ret = do_socketcallwrapper(SOCKOP_getpeername, arg1, arg2, arg3, arg4, arg5, arg6);
+ break;
+#endif
+
+#ifdef TARGET_NR_getsockname
+ case TARGET_NR_getsockname:
+ ret = do_socketcallwrapper(SOCKOP_getsockname, arg1, arg2, arg3, arg4, arg5, arg6);
+ break;
+#endif
+
+#ifdef TARGET_NR_listen
+ case TARGET_NR_listen:
+ ret = do_socketcallwrapper(SOCKOP_listen, arg1, arg2, arg3, arg4, arg5, arg6);
+ break;
+#endif
+
+
+#ifdef TARGET_NR_recv
+ case TARGET_NR_recv:
+ ret = do_socketcallwrapper(SOCKOP_recv, arg1, arg2, arg3, arg4, arg5, arg6);
+ break;
+#endif
+
+#ifdef TARGET_NR_recvfrom
+ case TARGET_NR_recvfrom:
+ ret = do_socketcallwrapper(SOCKOP_recvfrom, arg1, arg2, arg3, arg4, arg5, arg6);
+ break;
+#endif
+
+#ifdef TARGET_NR_recvmsg
+ case TARGET_NR_recvmsg:
+ ret = do_socketcallwrapper(SOCKOP_recvmsg, arg1, arg2, arg3, arg4, arg5, arg6);
+ break;
+#endif
+
+#ifdef TARGET_NR_send
+ case TARGET_NR_send:
+ ret = do_socketcallwrapper(SOCKOP_send, arg1, arg2, arg3, arg4, arg5, arg6);
+ break;
+#endif
+
+#ifdef TARGET_NR_sendmsg
+ case TARGET_NR_sendmsg:
+ ret = do_socketcallwrapper(SOCKOP_sendmsg, arg1, arg2, arg3, arg4, arg5, arg6);
+ break;
+#endif
+
+#ifdef TARGET_NR_sendto
+ case TARGET_NR_sendto:
+ ret = do_socketcallwrapper(SOCKOP_sendto, arg1, arg2, arg3, arg4, arg5, arg6);
+ break;
+#endif
+
+#ifdef TARGET_NR_shutdown
+ case TARGET_NR_shutdown:
+ ret = do_socketcallwrapper(SOCKOP_shutdown, arg1, arg2, arg3, arg4, arg5, arg6);
+ break;
+#endif
+
+#ifdef TARGET_NR_socket
+ case TARGET_NR_socket:
+ ret = do_socketcallwrapper(SOCKOP_socket, arg1, arg2, arg3, arg4, arg5, arg6);
+ break;
+#endif
+
+#ifdef TARGET_NR_socketpair
+ case TARGET_NR_socketpair:
+ ret = do_socketcallwrapper(SOCKOP_socketpair, arg1, arg2, arg3, arg4, arg5, arg6);
+ break;
+#endif
+
+#ifdef TARGET_NR_setsockopt
+ case TARGET_NR_setsockopt:
+ ret = do_setsockopt(arg1, arg2, arg3, arg4, (socklen_t) arg5);
+ break;
+#endif
+
case TARGET_NR_syslog:
goto unimplemented;
case TARGET_NR_setitimer:
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] mips-user socket-related syscall support
2006-06-20 8:47 ` Raphaël Rigo
@ 2006-06-22 17:14 ` Raphaël Rigo
2006-06-24 15:08 ` Fabrice Bellard
0 siblings, 1 reply; 8+ messages in thread
From: Raphaël Rigo @ 2006-06-22 17:14 UTC (permalink / raw)
To: qemu-devel
Raphaël Rigo wrote:
> Fabrice Bellard wrote:
>> Another point is that doing:
>>
>> + target_long args[6];
>> +
>> + tputl(args, arg1);
>> + tputl(args+1, arg2);
>> + tputl(args+2, arg3);
>> + tputl(args+3, arg4);
>> + tputl(args+4, arg5);
>> + tputl(args+5, arg6);
>>
>> at the start of every syscall is not acceptable. You should add a
>> specific socket call wrapper which takes arg1... arg6 as arguments.
>>
>> Regards,
>>
>> Fabrice.
> Thanks for reviewing it, the new attached version should be much cleaner.
>
> Regards,
> Raphaël
Sorry to insist, but can you please include it in the CVS? I really think it's
useful.
Thanks,
Raphaël
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] mips-user socket-related syscall support
2006-06-22 17:14 ` Raphaël Rigo
@ 2006-06-24 15:08 ` Fabrice Bellard
0 siblings, 0 replies; 8+ messages in thread
From: Fabrice Bellard @ 2006-06-24 15:08 UTC (permalink / raw)
To: Raphaël Rigo; +Cc: qemu-devel
Raphaël Rigo wrote:
> Raphaël Rigo wrote:
>
>>Fabrice Bellard wrote:
>>
>>>Another point is that doing:
>>>
>>>+ target_long args[6];
>>>+
>>>+ tputl(args, arg1);
>>>+ tputl(args+1, arg2);
>>>+ tputl(args+2, arg3);
>>>+ tputl(args+3, arg4);
>>>+ tputl(args+4, arg5);
>>>+ tputl(args+5, arg6);
>>>
>>>at the start of every syscall is not acceptable. You should add a
>>>specific socket call wrapper which takes arg1... arg6 as arguments.
>>>
>>>Regards,
>>>
>>>Fabrice.
>>
>>Thanks for reviewing it, the new attached version should be much cleaner.
>>
>>Regards,
>>Raphaël
>
> Sorry to insist, but can you please include it in the CVS? I really think it's
> useful.
I applied it and added "getsockopt". In fact, you should completely
suppress do_socketcallwrapper() (using tputl and tgetl for non user
access is bad).
Regards,
Fabrice.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-06-24 15:09 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-19 9:00 [Qemu-devel] [PATCH] mips-user socket-related syscall support Raphaël Rigo
2006-06-19 22:03 ` Fabrice Bellard
2006-06-20 6:54 ` Raphaël Rigo
2006-06-20 8:28 ` Thiemo Seufer
2006-06-19 22:52 ` Fabrice Bellard
2006-06-20 8:47 ` Raphaël Rigo
2006-06-22 17:14 ` Raphaël Rigo
2006-06-24 15:08 ` Fabrice Bellard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).