On 1 April 2013 16:49, Petar Jovanovic <petar.jovano...@rt-rk.com> wrote: > From: Petar Jovanovic <petar.jovano...@imgtec.com> > > Previous implementation has failed to take into account different value of > SOCK_NONBLOCK on target and host, and existence of SOCK_CLOEXEC. > The same conversion has to be applied both for do_socket and do_socketpair, > so the code has been isolated in a static inline function. > The change is valid for architectures that define ARCH_HAS_SOCKET_TYPES, > these are MIPS, SPARC and ALPHA now. > +#if defined(ARCH_HAS_SOCKET_TYPES) > +static inline void target_to_host_sock_type(int *type) > {
[etc] I apologise for the hugely late review on this patch, but this looks odd. Whether we need to translate SOCK_* constants doesn't just depend on the target architecture, but also on the host. (Consider running QEMU on MIPS and emulating x86.) I think that we need to make sure that we define TARGET_SOCK_* for all architectures (ie with a bit in the common section that goes #ifndef ARCH_HAS_SOCKET_TYPES [default stuff]), and then unconditionally define and call target_to_host_sock_type in syscall.c. thanks -- PMM