[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 6/8] linux-user: update ARCH_HAS_SOCKET_TYPES
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH v3 6/8] linux-user: update ARCH_HAS_SOCKET_TYPES use |
Date: |
Mon, 21 May 2018 10:19:10 +0100 |
On 19 May 2018 at 10:29, Laurent Vivier <address@hidden> wrote:
> to be like in the kernel and rename it TARGET_ARCH_HAS_SOCKET_TYPES
You could note in the commit message that this fixes our
incorrect definition of TARGET_SOCK_CLOEXEC for SPARC.
> Signed-off-by: Laurent Vivier <address@hidden>
> ---
> linux-user/alpha/sockbits.h | 36 +++-----------------------
> linux-user/hppa/sockbits.h | 33 +++---------------------
> linux-user/mips/sockbits.h | 9 ++++---
> linux-user/socket.h | 62
> +++++++++++++++++++++++----------------------
> linux-user/sparc/sockbits.h | 36 --------------------------
> 5 files changed, 44 insertions(+), 132 deletions(-)
>
> diff --git a/linux-user/alpha/sockbits.h b/linux-user/alpha/sockbits.h
> index 4db3e52b67..f5397dd875 100644
> --- a/linux-user/alpha/sockbits.h
> +++ b/linux-user/alpha/sockbits.h
> @@ -75,39 +75,9 @@
> /* Instruct lower device to use last 4-bytes of skb data as FCS */
> #define TARGET_SO_NOFCS 43
>
> -/** sock_type - Socket types
> - *
> - * Please notice that for binary compat reasons ALPHA has to
> - * override the enum sock_type in include/linux/net.h, so
> - * we define ARCH_HAS_SOCKET_TYPES here.
> - *
> - * @SOCK_DGRAM - datagram (conn.less) socket
> - * @SOCK_STREAM - stream (connection) socket
> - * @SOCK_RAW - raw socket
> - * @SOCK_RDM - reliably-delivered message
> - * @SOCK_SEQPACKET - sequential packet socket
> - * @SOCK_DCCP - Datagram Congestion Control Protocol socket
> - * @SOCK_PACKET - linux specific way of getting packets at the dev level.
> - * For writing rarp and other similar things on the user
> - * level.
> - * @SOCK_CLOEXEC - sets the close-on-exec (FD_CLOEXEC) flag.
> - * @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag.
> +/* TARGET_O_NONBLOCK clashes with the bits used for socket types. Therefore
> we
> + * have to define SOCK_NONBLOCK to a different value here.
> */
> +#define TARGET_SOCK_NONBLOCK 0x40000000
This new value is different from the old value in the enum:
> -#define ARCH_HAS_SOCKET_TYPES 1
> -
> -enum sock_type {
> - TARGET_SOCK_STREAM = 1,
> - TARGET_SOCK_DGRAM = 2,
> - TARGET_SOCK_RAW = 3,
> - TARGET_SOCK_RDM = 4,
> - TARGET_SOCK_SEQPACKET = 5,
> - TARGET_SOCK_DCCP = 6,
> - TARGET_SOCK_PACKET = 10,
> - TARGET_SOCK_CLOEXEC = 010000000,
> - TARGET_SOCK_NONBLOCK = 010000000000,
...does it matter?
Neither are the same as Alpha's actual SOCK_NONBLOCK value,
which as far as I can tell is 4. The comment suggests that we're
deliberately avoiding a clash with the socket-type values, but
do you know how this works? I don't see how we can do the right
thing if we're not using the actual bit values the guest wants...
Otherwise
Reviewed-by: Peter Maydell <address@hidden>
thanks
-- PMM
- [Qemu-devel] [PATCH v3 0/8] linux-user: move socket.h definitions to CPU directories, Laurent Vivier, 2018/05/19
- [Qemu-devel] [PATCH v3 1/8] linux-user: move mips socket.h definitions to mips/sockbits.h, Laurent Vivier, 2018/05/19
- [Qemu-devel] [PATCH v3 3/8] linux-user: move sparc/sparc64 socket.h definitions to sparc/sockbits.h, Laurent Vivier, 2018/05/19
- [Qemu-devel] [PATCH v3 8/8] linux-user: define TARGET_SO_REUSEPORT, Laurent Vivier, 2018/05/19
- [Qemu-devel] [PATCH v3 2/8] linux-user: move alpha socket.h definitions to alpha/sockbits.h, Laurent Vivier, 2018/05/19
- [Qemu-devel] [PATCH v3 6/8] linux-user: update ARCH_HAS_SOCKET_TYPES use, Laurent Vivier, 2018/05/19
- Re: [Qemu-devel] [PATCH v3 6/8] linux-user: update ARCH_HAS_SOCKET_TYPES use,
Peter Maydell <=
[Qemu-devel] [PATCH v3 7/8] linux-user: copy sparc/sockbits.h definitions from linux, Laurent Vivier, 2018/05/19
[Qemu-devel] [PATCH v3 4/8] linux-user: move socket.h generic definitions to generic/sockbits.h, Laurent Vivier, 2018/05/19
[Qemu-devel] [PATCH v3 5/8] linux-user: move ppc socket.h definitions to ppc/sockbits.h, Laurent Vivier, 2018/05/19
Re: [Qemu-devel] [PATCH v3 0/8] linux-user: move socket.h definitions to CPU directories, no-reply, 2018/05/21