________________________________________
From: Peter Maydell [peter.mayd...@linaro.org]
Sent: Thursday, June 27, 2013 7:21 PM
To: Petar Jovanovic
Cc: qemu-devel@nongnu.org; blauwir...@gmail.com; riku.voi...@linaro.org; Petar 
Jovanovic; aurel...@aurel32.net; r...@twiddle.net
Subject: Re: [Qemu-devel] [PATCH v2] linux-user: improve 
target_to_host_sock_type conversion

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

I have just resubmitted the patch with this addition included.
Check for [PATCH v3].

Thanks.

Petar

Reply via email to