qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 5/5] linux-user: copy sparc/sockbits.h definitio


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 5/5] linux-user: copy sparc/sockbits.h definitions from linux
Date: Fri, 11 May 2018 13:07:31 +0100

On 10 May 2018 at 23:26, Laurent Vivier <address@hidden> wrote:
> Values defined for sparc are not correct.
> Copy the content of "arch/sparc/include/uapi/asm/socket.h"
> to fix them.
>
> Signed-off-by: Laurent Vivier <address@hidden>
> ---
>  linux-user/sparc/sockbits.h | 161 
> ++++++++++++++++++++++++--------------------
>  1 file changed, 89 insertions(+), 72 deletions(-)
>
> diff --git a/linux-user/sparc/sockbits.h b/linux-user/sparc/sockbits.h
> index 385061c8b0..0a822e3e1f 100644
> --- a/linux-user/sparc/sockbits.h
> +++ b/linux-user/sparc/sockbits.h
> @@ -8,87 +8,104 @@
>  #ifndef SPARC_SOCKBITS_H
>  #define SPARC_SOCKBITS_H
>
> -/** sock_type - Socket types
> - *
> - * Please notice that for binary compat reasons SPARC 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.
> - */
> +/* For setsockopt(2) */
> +#define TARGET_SOL_SOCKET      0xffff
>
> -#define ARCH_HAS_SOCKET_TYPES          1

This is what the kernel does, but for QEMU it will result
in the wrong value for TARGET_SOCK_CLOEXEC (though it does
fix the value for TARGET_SOCK_NONBLOCK).
This is because in QEMU the default values are hardcoded:

           TARGET_SOCK_CLOEXEC     = 02000000,
           TARGET_SOCK_NONBLOCK    = 04000,

whereas in linux's include/linux/net.h they are defined in terms
of other arch-specific constants:
#define SOCK_CLOEXEC    O_CLOEXEC
#ifndef SOCK_NONBLOCK
#define SOCK_NONBLOCK   O_NONBLOCK
#endif

Cleaning up QEMU so its ARCH_HAS_SOCKET_TYPES has the same
semantics as the kernel is probably the right way to go.

thanks
-- PMM



reply via email to

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