qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] linux-user: improve target_to_host_sock_type


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v2] linux-user: improve target_to_host_sock_type conversion
Date: Thu, 27 Jun 2013 18:21:28 +0100

On 1 April 2013 16:49, Petar Jovanovic <address@hidden> wrote:
> From: Petar Jovanovic <address@hidden>
>
> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]