Skip to contentSkip to conversation

Implement socket syscalls for platforms that do not use socketcall

PATCH New Raphaël Rigo 1 participant 1 message Mar 16, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Implement socket syscalls for platforms that do not use socketcall

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

qemu.h +1 -0
diff -u -r1.24 qemu.h
@@ -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

syscall.c +189 -34

268 lines not on this page · raw message

Index: linux-user/arm/socket.h
===================================================================
RCS file: linux-user/arm/socket.h

arm/socket.h new file +45 -0

45 lines not on this page · raw message

Index: linux-user/i386/socket.h
===================================================================
RCS file: linux-user/i386/socket.h

i386/socket.h new file +45 -0

45 lines not on this page · raw message

Index: linux-user/mips/socket.h
===================================================================
RCS file: linux-user/mips/socket.h

mips/socket.h new file +87 -0

87 lines not on this page · raw message

Index: linux-user/ppc/socket.h
===================================================================
RCS file: linux-user/ppc/socket.h

ppc/socket.h new file +45 -0

45 lines not on this page · raw message

Index: linux-user/sparc/socket.h
===================================================================
RCS file: linux-user/sparc/socket.h

sparc/socket.h new file +49 -0

49 lines not on this page · raw message

Index: linux-user/sparc64/socket.h
===================================================================
RCS file: linux-user/sparc64/socket.h

sparc64/socket.h new file +49 -0

49 lines not on this page · raw message