[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: |
Petar Jovanovic |
Subject: |
Re: [Qemu-devel] [PATCH v2] linux-user: improve target_to_host_sock_type conversion |
Date: |
Mon, 1 Jul 2013 00:48:14 +0000 |
________________________________________
From: Peter Maydell address@hidden
Sent: Thursday, June 27, 2013 7:21 PM
To: Petar Jovanovic
Cc: address@hidden; address@hidden; address@hidden; Petar Jovanovic;
address@hidden; address@hidden
Subject: Re: [Qemu-devel] [PATCH v2] linux-user: improve
target_to_host_sock_type conversion
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
I have just resubmitted the patch with this addition included.
Check for [PATCH v3].
Thanks.
Petar