Hi,
this is a rather quick and dirty patch that allows programs running in user
emulation mode to call socket related syscalls on platforms that do not have the
socketcall syscall, for example MIPS.

The calls implemented are : accept, bind, connect, getpeername, getsockname,
listen, recv, recvfrom, recvmsg, send, sendmsg, sendto, shutdown, socket,
socketpair.

It also enables platform-specific socket.h headers and a special case for mips
which as (it's the ONLY platform supported by the linux kernel that has this
problem) a specific sock_type enum (SOCK_STREAM and all).

Beware, I only tested some of these syscalls on mipsel, so testing is welcomed
and if people consider it not that dirty, it could be even considered for
inclusion after testing ;)


Raphaël Rigo




Index: linux-user/qemu.h
===================================================================
RCS file: /sources/qemu/qemu/linux-user/qemu.h,v
retrieving revision 1.24
diff -u -r1.24 qemu.h
--- linux-user/qemu.h   23 Apr 2005 18:25:40 -0000      1.24
+++ linux-user/qemu.h   16 Mar 2006 15:08:24 -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.66
diff -u -r1.66 syscall.c
--- linux-user/syscall.c        9 Feb 2006 16:49:55 -0000       1.66
+++ linux-user/syscall.c        16 Mar 2006 15:08:26 -0000
@@ -531,7 +531,7 @@
                           void *optval, socklen_t optlen)
 {
     int val, ret;
-            
+    
     switch(level) {
     case SOL_TCP:
         /* TCP options all take an 'int' value.  */
@@ -573,34 +573,68 @@
             goto unimplemented;
         }
         break;
-    case SOL_SOCKET:
+    case TARGET_SOL_SOCKET:
+        if (optlen < sizeof(uint32_t))
+           return -EINVAL;
+        if (get_user(val, (uint32_t *)optval))
+           return -EFAULT;
         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:
-#ifdef SO_BSDCOMPAT
-        case SO_BSDCOMPAT:
-#endif
-        case SO_PASSCRED:
-        case SO_TIMESTAMP:
-        case SO_RCVLOWAT:
-        case SO_RCVTIMEO:
-        case SO_SNDTIMEO:
-            if (optlen < sizeof(uint32_t))
-                return -EINVAL;
-            if (get_user(val, (uint32_t *)optval))
-                return -EFAULT;
-            ret = get_errno(setsockopt(sockfd, level, optname, &val, 
sizeof(val)));
+        case TARGET_SO_DEBUG:
+            ret = get_errno(setsockopt(sockfd, SOL_SOCKET, SO_DEBUG, &val, 
sizeof(val)));
+           break;
+        case TARGET_SO_REUSEADDR:
+            ret = get_errno(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &val, 
sizeof(val)));
+           break;
+        case TARGET_SO_TYPE:
+            ret = get_errno(setsockopt(sockfd, SOL_SOCKET, SO_TYPE, &val, 
sizeof(val)));
+           break;
+        case TARGET_SO_ERROR:
+            ret = get_errno(setsockopt(sockfd, SOL_SOCKET, SO_ERROR, &val, 
sizeof(val)));
+           break;
+        case TARGET_SO_DONTROUTE:
+            ret = get_errno(setsockopt(sockfd, SOL_SOCKET, SO_DONTROUTE, &val, 
sizeof(val)));
+           break;
+        case TARGET_SO_BROADCAST:
+            ret = get_errno(setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &val, 
sizeof(val)));
+           break;
+        case TARGET_SO_SNDBUF:
+            ret = get_errno(setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, &val, 
sizeof(val)));
+           break;
+        case TARGET_SO_RCVBUF:
+            ret = get_errno(setsockopt(sockfd, SOL_SOCKET, SO_RCVBUF, &val, 
sizeof(val)));
+           break;
+        case TARGET_SO_KEEPALIVE:
+            ret = get_errno(setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &val, 
sizeof(val)));
+           break;
+        case TARGET_SO_OOBINLINE:
+            ret = get_errno(setsockopt(sockfd, SOL_SOCKET, SO_OOBINLINE, &val, 
sizeof(val)));
+           break;
+        case TARGET_SO_NO_CHECK:
+            ret = get_errno(setsockopt(sockfd, SOL_SOCKET, SO_NO_CHECK, &val, 
sizeof(val)));
+           break;
+        case TARGET_SO_PRIORITY:
+            ret = get_errno(setsockopt(sockfd, SOL_SOCKET, SO_PRIORITY, &val, 
sizeof(val)));
+           break;
+#ifdef TARGET_SO_BSDCOMPAT
+        case TARGET_SO_BSDCOMPAT:
+            ret = get_errno(setsockopt(sockfd, SOL_SOCKET, SO_BSDCOMPAT, &val, 
sizeof(val)));
+           break;
+#endif
+        case TARGET_SO_PASSCRED:
+            ret = get_errno(setsockopt(sockfd, SOL_SOCKET, SO_PASSCRED, &val, 
sizeof(val)));
+           break;
+        case TARGET_SO_TIMESTAMP:
+            ret = get_errno(setsockopt(sockfd, SOL_SOCKET, SO_TIMESTAMP, &val, 
sizeof(val)));
+           break;
+        case TARGET_SO_RCVLOWAT:
+            ret = get_errno(setsockopt(sockfd, SOL_SOCKET, SO_RCVLOWAT, &val, 
sizeof(val)));
+           break;
+        case TARGET_SO_RCVTIMEO:
+            ret = get_errno(setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &val, 
sizeof(val)));
+           break;
+        case TARGET_SO_SNDTIMEO:
+            ret = get_errno(setsockopt(sockfd, SOL_SOCKET, SO_SNDTIMEO, &val, 
sizeof(val)));
             break;
         default:
             goto unimplemented;
@@ -620,13 +654,13 @@
     int len, lv, val, ret;
 
     switch(level) {
-    case SOL_SOCKET:
+    case TARGET_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:
@@ -719,6 +753,28 @@
             int type = tswap32(vptr[1]);
             int protocol = tswap32(vptr[2]);
 
+#if defined(TARGET_MIPS)
+           switch(type) {
+                   case SOCK_DGRAM:
+                           type = TARGET_SOCK_DGRAM;
+                           break;
+                   case SOCK_STREAM:
+                           type = TARGET_SOCK_STREAM;
+                           break;
+                   case SOCK_RAW:
+                           type = TARGET_SOCK_RAW;
+                           break;
+                   case SOCK_RDM:
+                           type = TARGET_SOCK_RDM;
+                           break;
+                   case SOCK_SEQPACKET:
+                           type = TARGET_SOCK_SEQPACKET;
+                           break;
+                   case SOCK_PACKET:
+                           type = TARGET_SOCK_PACKET;
+                           break;
+                  }
+#endif
             ret = get_errno(socket(domain, type, protocol));
        }
         break;
@@ -745,7 +801,7 @@
         }
         break;
     case SOCKOP_listen:
-        {
+       {
             int sockfd = tswap32(vptr[0]);
             int backlog = tswap32(vptr[1]);
 
@@ -1696,6 +1752,7 @@
     long ret;
     struct stat st;
     struct statfs stfs;
+    long args[] = {arg1, arg2, arg3, arg4, arg5, arg6};
     
 #ifdef DEBUG
     gemu_log("syscall %d", num);
@@ -2382,6 +2439,104 @@
     case TARGET_NR_socketcall:
         ret = do_socketcall(arg1, (int32_t *)arg2);
         break;
+
+#ifdef TARGET_NR_accept
+    case TARGET_NR_accept:
+       ret = do_socketcall(SOCKOP_accept, (int32_t *)args);
+       break;
+#endif
+
+#ifdef TARGET_NR_bind
+    case TARGET_NR_bind:
+       ret = do_socketcall(SOCKOP_bind, (int32_t *)args);
+       break;
+#endif
+
+#ifdef TARGET_NR_connect
+    case TARGET_NR_connect:
+       ret = do_socketcall(SOCKOP_connect, (int32_t *)args);
+       break;
+#endif
+
+#ifdef TARGET_NR_getpeername
+    case TARGET_NR_getpeername:
+       ret = do_socketcall(SOCKOP_getpeername, (int32_t *)args);
+       break;
+#endif
+
+#ifdef TARGET_NR_getsockname
+    case TARGET_NR_getsockname:
+       ret = do_socketcall(SOCKOP_getsockname, (int32_t *)args);
+       break;
+#endif
+
+#ifdef TARGET_NR_listen
+    case TARGET_NR_listen:
+       ret = do_socketcall(SOCKOP_listen, (int32_t *)args);
+       break;
+#endif
+
+
+#ifdef TARGET_NR_recv
+    case TARGET_NR_recv:
+       ret = do_socketcall(SOCKOP_recv, (int32_t *)args);
+       break;
+#endif
+
+#ifdef TARGET_NR_recvfrom
+    case TARGET_NR_recvfrom:
+       ret = do_socketcall(SOCKOP_recvfrom, (int32_t *)args);
+       break;
+#endif
+
+#ifdef TARGET_NR_recvmsg
+    case TARGET_NR_recvmsg:
+       ret = do_socketcall(SOCKOP_recvmsg, (int32_t *)args);
+       break;
+#endif
+
+#ifdef TARGET_NR_send
+    case TARGET_NR_send:
+       ret = do_socketcall(SOCKOP_send, (int32_t *)args);
+       break;
+#endif
+
+#ifdef TARGET_NR_sendmsg
+    case TARGET_NR_sendmsg:
+       ret = do_socketcall(SOCKOP_sendmsg, (int32_t *)args);
+       break;
+#endif
+
+#ifdef TARGET_NR_sendto
+    case TARGET_NR_sendto:
+       ret = do_socketcall(SOCKOP_sendto, (int32_t *)args);
+       break;
+#endif
+
+#ifdef TARGET_NR_shutdown
+    case TARGET_NR_shutdown:
+       ret = do_socketcall(SOCKOP_shutdown, (int32_t *)args);
+       break;
+#endif
+
+#ifdef TARGET_NR_socket
+    case TARGET_NR_socket:
+       ret = do_socketcall(SOCKOP_socket, (int32_t *)args);
+       break;
+#endif
+
+#ifdef TARGET_NR_socketpair
+    case TARGET_NR_socketpair:
+       ret = do_socketcall(SOCKOP_socketpair, (int32_t *)args);
+       break;
+#endif
+
+#ifdef TARGET_NR_setsockopt
+    case TARGET_NR_setsockopt:
+       ret = do_setsockopt(arg1, tswap32(arg2), tswap32(arg3), (void *)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     16 Mar 2006 15:08:26 -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    16 Mar 2006 15:08:26 -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    16 Mar 2006 15:08:26 -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     16 Mar 2006 15:08:26 -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   16 Mar 2006 15:08:26 -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 16 Mar 2006 15:08:26 -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



_______________________________________________
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Reply via email to