linux-user: refactor socket.h into architecture specific sockbits
cover linux-user: refactor socket.h into architecture specific sockbits
the definitions in socket.h are meant to reflect the ones in linux for each respective target, but are sometimes difficult to maintain.
hppa (AKA parisc) was initially merged with an independent file that mirrors more closely the corresponding one in linux but hasn't been updated since.
while testing what should had been a simple change (adding to setsockopt support for another SO flag) it became obvious that doing this refactor would help making the code easier to understand and avoid hard to see bugs (like definitions set to the wrong target as shown for sparc at least)
the changes are somehow mechanical, and I had made an effort to try to identify what has changed (and hopefully fix a bug), but there is a high probability something as silly as a typo might have introduced a bug, therefore, testing for each target is encouraged but not something I could do on my own (being new to qemu-user and not having access to the corresponding sysroots)
the fact that it is most likely that most socket functions where not working for sparc, sparc64, mips64 and ppc64 is most likely an indication that more testing (and regressions) is likely needed around this, so suggestions and help on that is also needed.
RFC 1/6 linux-user: update hppa sockbits
updated to match arch/parisc/include/uapi/asm/socket.h from linux 4.14
--- linux-user/hppa/sockbits.h | 148 +++++++++++++++++++++++---------------------- linux-user/socket.h | 2 +- 2 files changed, 78 insertions(+), 72 deletions(-)
linux-user/hppa/sockbits.h +77 -71
@@ -1,71 +1,77 @@ -#define TARGET_SOL_SOCKET 0xffff +#define TARGET_SOL_SOCKET 0xffff -#define TARGET_SO_DEBUG 0x0001 -#define TARGET_SO_REUSEADDR 0x0004 -#define TARGET_SO_KEEPALIVE 0x0008 -#define TARGET_SO_DONTROUTE 0x0010 -#define TARGET_SO_BROADCAST 0x0020 -#define TARGET_SO_LINGER 0x0080 -#define TARGET_SO_OOBINLINE 0x0100 -#define TARGET_SO_REUSEPORT 0x0200 -#define TARGET_SO_SNDBUF 0x1001 -#define TARGET_SO_RCVBUF 0x1002 -#define TARGET_SO_SNDBUFFORCE 0x100a -#define TARGET_SO_RCVBUFFORCE 0x100b -#define TARGET_SO_SNDLOWAT 0x1003 -#define TARGET_SO_RCVLOWAT 0x1004 -#define TARGET_SO_SNDTIMEO 0x1005 -#define TARGET_SO_RCVTIMEO 0x1006 -#define TARGET_SO_ERROR 0x1007 -#define TARGET_SO_TYPE 0x1008 -#define TARGET_SO_PROTOCOL 0x1028 -#define TARGET_SO_DOMAIN 0x1029 -#define TARGET_SO_PEERNAME 0x2000 -#define TARGET_SO_NO_CHECK 0x400b -#define TARGET_SO_PRIORITY 0x400c -#define TARGET_SO_BSDCOMPAT 0x400e -#define TARGET_SO_PASSCRED 0x4010 -#define TARGET_SO_PEERCRED 0x4011 -#define TARGET_SO_TIMESTAMP 0x4012 -#define TARGET_SCM_TIMESTAMP TARGET_SO_TIMESTAMP -#define TARGET_SO_TIMESTAMPNS 0x4013 -#define TARGET_SCM_TIMESTAMPNS TARGET_SO_TIMESTAMPNS +#define TARGET_SO_DEBUG 0x0001 +#define TARGET_SO_REUSEADDR 0x0004 +#define TARGET_SO_KEEPALIVE 0x0008 +#define TARGET_SO_DONTROUTE 0x0010 +#define TARGET_SO_BROADCAST 0x0020 +#define TARGET_SO_LINGER 0x0080 +#define TARGET_SO_OOBINLINE 0x0100 +#define TARGET_SO_REUSEPORT 0x0200 +#define TARGET_SO_SNDBUF 0x1001 +#define TARGET_SO_RCVBUF 0x1002 +#define TARGET_SO_SNDBUFFORCE 0x100a +#define TARGET_SO_RCVBUFFORCE 0x100b +#define TARGET_SO_SNDLOWAT 0x1003 +#define TARGET_SO_RCVLOWAT 0x1004 +#define TARGET_SO_SNDTIMEO 0x1005 +#define TARGET_SO_RCVTIMEO 0x1006 +#define TARGET_SO_ERROR 0x1007 +#define TARGET_SO_TYPE 0x1008 +#define TARGET_SO_PROTOCOL 0x1028 +#define TARGET_SO_DOMAIN 0x1029 +#define TARGET_SO_PEERNAME 0x2000 +#define TARGET_SO_NO_CHECK 0x400b +#define TARGET_SO_PRIORITY 0x400c +#define TARGET_SO_BSDCOMPAT 0x400e +#define TARGET_SO_PASSCRED 0x4010 +#define TARGET_SO_PEERCRED 0x4011 +#define TARGET_SO_TIMESTAMP 0x4012 +#define TARGET_SCM_TIMESTAMP TARGET_SO_TIMESTAMP +#define TARGET_SO_TIMESTAMPNS 0x4013 +#define TARGET_SCM_TIMESTAMPNS TARGET_SO_TIMESTAMPNS -#define TARGET_SO_SECURITY_AUTHENTICATION 0x4016 -#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 0x4017 -#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 0x4018 +#define TARGET_SO_SECURITY_AUTHENTICATION 0x4016 +#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 0x4017 +#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 0x4018 -#define TARGET_SO_BINDTODEVICE 0x4019 -#define TARGET_SO_ATTACH_FILTER 0x401a -#define TARGET_SO_DETACH_FILTER 0x401b -#define TARGET_SO_GET_FILTER TARGET_SO_ATTACH_FILTER -#define TARGET_SO_ACCEPTCONN 0x401c -#define TARGET_SO_PEERSEC 0x401d -#define TARGET_SO_PASSSEC 0x401e -#define TARGET_SO_MARK 0x401f -#define TARGET_SO_TIMESTAMPING 0x4020 -#define TARGET_SCM_TIMESTAMPING TARGET_SO_TIMESTAMPING -#define TARGET_SO_RXQ_OVFL 0x4021 -#define TARGET_SO_WIFI_STATUS 0x4022 -#define TARGET_SCM_WIFI_STATUS TARGET_SO_WIFI_STATUS -#define TARGET_SO_PEEK_OFF 0x4023 -#define TARGET_SO_NOFCS 0x4024 -#define TARGET_SO_LOCK_FILTER 0x4025 -#define TARGET_SO_SELECT_ERR_QUEUE 0x4026 -#define TARGET_SO_BUSY_POLL 0x4027 -#define TARGET_SO_MAX_PACING_RATE 0x4028 -#define TARGET_SO_BPF_EXTENSIONS 0x4029 -#define TARGET_SO_INCOMING_CPU 0x402A -#define TARGET_SO_ATTACH_BPF 0x402B -#define TARGET_SO_DETACH_BPF TARGET_SO_DETACH_FILTER +#define TARGET_SO_BINDTODEVICE 0x4019 +#define TARGET_SO_ATTACH_FILTER 0x401a +#define TARGET_SO_DETACH_FILTER 0x401b +#define TARGET_SO_GET_FILTER TARGET_SO_ATTACH_FILTER +#define TARGET_SO_ACCEPTCONN 0x401c +#define TARGET_SO_PEERSEC 0x401d +#define TARGET_SO_PASSSEC 0x401e +#define TARGET_SO_MARK 0x401f +#define TARGET_SO_TIMESTAMPING 0x4020 +#define TARGET_SCM_TIMESTAMPING TARGET_SO_TIMESTAMPING +#define TARGET_SO_RXQ_OVFL 0x4021 +#define TARGET_SO_WIFI_STATUS 0x4022 +#define TARGET_SCM_WIFI_STATUS TARGET_SO_WIFI_STATUS +#define TARGET_SO_PEEK_OFF 0x4023 +#define TARGET_SO_NOFCS 0x4024 +#define TARGET_SO_LOCK_FILTER 0x4025 +#define TARGET_SO_SELECT_ERR_QUEUE 0x4026 +#define TARGET_SO_BUSY_POLL 0x4027 +#define TARGET_SO_MAX_PACING_RATE 0x4028 +#define TARGET_SO_BPF_EXTENSIONS 0x4029 +#define TARGET_SO_INCOMING_CPU 0x402A +#define TARGET_SO_ATTACH_BPF 0x402B +#define TARGET_SO_DETACH_BPF TARGET_SO_DETACH_FILTER -#define TARGET_SO_ATTACH_REUSEPORT_CBPF 0x402C -#define TARGET_SO_ATTACH_REUSEPORT_EBPF 0x402D +#define TARGET_SO_ATTACH_REUSEPORT_CBPF 0x402C +#define TARGET_SO_ATTACH_REUSEPORT_EBPF 0x402D -#define TARGET_SO_CNX_ADVICE 0x402E +#define TARGET_SO_CNX_ADVICE 0x402E +#define TARGET_SCM_TIMESTAMPING_OPT_STATS 0x402F +#define TARGET_SO_MEMINFO 0x4030 +#define TARGET_SO_INCOMING_NAPI_ID 0x4031 +#define TARGET_SO_COOKIE 0x4032 +#define TARGET_SCM_TIMESTAMPING_PKTINFO 0x4033 +#define TARGET_SO_PEERGROUPS 0x4034 +#define TARGET_SO_ZEROCOPY 0x4035/** sock_type - Socket types - default values -* * * @SOCK_STREAM - stream (connection) socket * @SOCK_DGRAM - datagram (conn.less) socket
@@ -80,18 +86,18 @@* @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag. */ 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 =0x40000000 , +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 =0x40000000 , };#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1) -#define TARGET_SOCK_TYPE_MASK 0xf/* Covers up to TARGET_SOCK_MAX-1. */ +#define TARGET_SOCK_TYPE_MASK 0xf/* Covers up to TARGET_SOCK_MAX - 1. */ #define ARCH_HAS_SOCKET_TYPES 1
linux-user/socket.h +1 -1
@@ -206,7 +206,7 @@#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)#define TARGET_SOCK_TYPE_MASK 0xf/* Covers up to TARGET_SOCK_MAX-1. */ #elif defined(TARGET_HPPA ) -#include <hppa/sockbits.h> +#include "hppa/sockbits.h" #else #if defined(TARGET_SPARC )
Signature · 1 line
2.14.1
Re: [Qemu-devel] [RFC 1/6] linux-user: update hppa sockbits
Le 22/09/2017 à 16:02, Carlo Marcelo Arenas Belón a écrit :
Quoted 186 lines
updated to match
arch/parisc/include/uapi/asm/socket.hfrom linux 4.14Signed-off-by Carlo Marcelo Arenas Belón <[email protected]>--- linux-user/hppa/sockbits.h | 148 +++++++++++++++++++++++---------------------- linux-user/socket.h | 2 +- 2 files changed, 78 insertions(+), 72 deletions(-)linux-user/hppa/sockbits.h +77
-71@@ -1,71 +1,77 @@ -#define TARGET_SOL_SOCKET 0xffff +#define TARGET_SOL_SOCKET 0xffff -#define TARGET_SO_DEBUG 0x0001 -#define TARGET_SO_REUSEADDR 0x0004 -#define TARGET_SO_KEEPALIVE 0x0008 -#define TARGET_SO_DONTROUTE 0x0010 -#define TARGET_SO_BROADCAST 0x0020 -#define TARGET_SO_LINGER 0x0080 -#define TARGET_SO_OOBINLINE 0x0100 -#define TARGET_SO_REUSEPORT 0x0200 -#define TARGET_SO_SNDBUF 0x1001 -#define TARGET_SO_RCVBUF 0x1002 -#define TARGET_SO_SNDBUFFORCE 0x100a -#define TARGET_SO_RCVBUFFORCE 0x100b -#define TARGET_SO_SNDLOWAT 0x1003 -#define TARGET_SO_RCVLOWAT 0x1004 -#define TARGET_SO_SNDTIMEO 0x1005 -#define TARGET_SO_RCVTIMEO 0x1006 -#define TARGET_SO_ERROR 0x1007 -#define TARGET_SO_TYPE 0x1008 -#define TARGET_SO_PROTOCOL 0x1028 -#define TARGET_SO_DOMAIN 0x1029 -#define TARGET_SO_PEERNAME 0x2000 -#define TARGET_SO_NO_CHECK 0x400b -#define TARGET_SO_PRIORITY 0x400c -#define TARGET_SO_BSDCOMPAT 0x400e -#define TARGET_SO_PASSCRED 0x4010 -#define TARGET_SO_PEERCRED 0x4011 -#define TARGET_SO_TIMESTAMP 0x4012 -#define TARGET_SCM_TIMESTAMP TARGET_SO_TIMESTAMP -#define TARGET_SO_TIMESTAMPNS 0x4013 -#define TARGET_SCM_TIMESTAMPNS TARGET_SO_TIMESTAMPNS +#define TARGET_SO_DEBUG 0x0001 +#define TARGET_SO_REUSEADDR 0x0004 +#define TARGET_SO_KEEPALIVE 0x0008 +#define TARGET_SO_DONTROUTE 0x0010 +#define TARGET_SO_BROADCAST 0x0020 +#define TARGET_SO_LINGER 0x0080 +#define TARGET_SO_OOBINLINE 0x0100 +#define TARGET_SO_REUSEPORT 0x0200 +#define TARGET_SO_SNDBUF 0x1001 +#define TARGET_SO_RCVBUF 0x1002 +#define TARGET_SO_SNDBUFFORCE 0x100a +#define TARGET_SO_RCVBUFFORCE 0x100b +#define TARGET_SO_SNDLOWAT 0x1003 +#define TARGET_SO_RCVLOWAT 0x1004 +#define TARGET_SO_SNDTIMEO 0x1005 +#define TARGET_SO_RCVTIMEO 0x1006 +#define TARGET_SO_ERROR 0x1007 +#define TARGET_SO_TYPE 0x1008 +#define TARGET_SO_PROTOCOL 0x1028 +#define TARGET_SO_DOMAIN 0x1029 +#define TARGET_SO_PEERNAME 0x2000 +#define TARGET_SO_NO_CHECK 0x400b +#define TARGET_SO_PRIORITY 0x400c +#define TARGET_SO_BSDCOMPAT 0x400e +#define TARGET_SO_PASSCRED 0x4010 +#define TARGET_SO_PEERCRED 0x4011 +#define TARGET_SO_TIMESTAMP 0x4012 +#define TARGET_SCM_TIMESTAMP TARGET_SO_TIMESTAMP +#define TARGET_SO_TIMESTAMPNS 0x4013 +#define TARGET_SCM_TIMESTAMPNS TARGET_SO_TIMESTAMPNS -#define TARGET_SO_SECURITY_AUTHENTICATION 0x4016 -#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 0x4017 -#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 0x4018 +#define TARGET_SO_SECURITY_AUTHENTICATION 0x4016 +#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 0x4017 +#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 0x4018 -#define TARGET_SO_BINDTODEVICE 0x4019 -#define TARGET_SO_ATTACH_FILTER 0x401a -#define TARGET_SO_DETACH_FILTER 0x401b -#define TARGET_SO_GET_FILTER TARGET_SO_ATTACH_FILTER -#define TARGET_SO_ACCEPTCONN 0x401c -#define TARGET_SO_PEERSEC 0x401d -#define TARGET_SO_PASSSEC 0x401e -#define TARGET_SO_MARK 0x401f -#define TARGET_SO_TIMESTAMPING 0x4020 -#define TARGET_SCM_TIMESTAMPING TARGET_SO_TIMESTAMPING -#define TARGET_SO_RXQ_OVFL 0x4021 -#define TARGET_SO_WIFI_STATUS 0x4022 -#define TARGET_SCM_WIFI_STATUS TARGET_SO_WIFI_STATUS -#define TARGET_SO_PEEK_OFF 0x4023 -#define TARGET_SO_NOFCS 0x4024 -#define TARGET_SO_LOCK_FILTER 0x4025 -#define TARGET_SO_SELECT_ERR_QUEUE 0x4026 -#define TARGET_SO_BUSY_POLL 0x4027 -#define TARGET_SO_MAX_PACING_RATE 0x4028 -#define TARGET_SO_BPF_EXTENSIONS 0x4029 -#define TARGET_SO_INCOMING_CPU 0x402A -#define TARGET_SO_ATTACH_BPF 0x402B -#define TARGET_SO_DETACH_BPF TARGET_SO_DETACH_FILTER +#define TARGET_SO_BINDTODEVICE 0x4019 +#define TARGET_SO_ATTACH_FILTER 0x401a +#define TARGET_SO_DETACH_FILTER 0x401b +#define TARGET_SO_GET_FILTER TARGET_SO_ATTACH_FILTER +#define TARGET_SO_ACCEPTCONN 0x401c +#define TARGET_SO_PEERSEC 0x401d +#define TARGET_SO_PASSSEC 0x401e +#define TARGET_SO_MARK 0x401f +#define TARGET_SO_TIMESTAMPING 0x4020 +#define TARGET_SCM_TIMESTAMPING TARGET_SO_TIMESTAMPING +#define TARGET_SO_RXQ_OVFL 0x4021 +#define TARGET_SO_WIFI_STATUS 0x4022 +#define TARGET_SCM_WIFI_STATUS TARGET_SO_WIFI_STATUS +#define TARGET_SO_PEEK_OFF 0x4023 +#define TARGET_SO_NOFCS 0x4024 +#define TARGET_SO_LOCK_FILTER 0x4025 +#define TARGET_SO_SELECT_ERR_QUEUE 0x4026 +#define TARGET_SO_BUSY_POLL 0x4027 +#define TARGET_SO_MAX_PACING_RATE 0x4028 +#define TARGET_SO_BPF_EXTENSIONS 0x4029 +#define TARGET_SO_INCOMING_CPU 0x402A +#define TARGET_SO_ATTACH_BPF 0x402B +#define TARGET_SO_DETACH_BPF TARGET_SO_DETACH_FILTER -#define TARGET_SO_ATTACH_REUSEPORT_CBPF 0x402C -#define TARGET_SO_ATTACH_REUSEPORT_EBPF 0x402D +#define TARGET_SO_ATTACH_REUSEPORT_CBPF 0x402C +#define TARGET_SO_ATTACH_REUSEPORT_EBPF 0x402D -#define TARGET_SO_CNX_ADVICE 0x402E +#define TARGET_SO_CNX_ADVICE 0x402E +#define TARGET_SCM_TIMESTAMPING_OPT_STATS 0x402F +#define TARGET_SO_MEMINFO 0x4030 +#define TARGET_SO_INCOMING_NAPI_ID 0x4031 +#define TARGET_SO_COOKIE 0x4032 +#define TARGET_SCM_TIMESTAMPING_PKTINFO 0x4033 +#define TARGET_SO_PEERGROUPS 0x4034 +#define TARGET_SO_ZEROCOPY 0x4035/** sock_type - Socket types - default values -* * * @SOCK_STREAM - stream (connection) socket * @SOCK_DGRAM - datagram (conn.less) socket @@ -80,18 +86,18 @@* @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag. */ 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 =0x40000000 , +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 =0x40000000 , };#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1) -#define TARGET_SOCK_TYPE_MASK 0xf/* Covers up to TARGET_SOCK_MAX-1. */ +#define TARGET_SOCK_TYPE_MASK 0xf/* Covers up to TARGET_SOCK_MAX - 1. */ #define ARCH_HAS_SOCKET_TYPES 1linux-user/socket.h +0
-0
linux-user/socket.h line 212
Quoted 8 lines
linux-user/socket.h +1
-1@@ -206,7 +206,7 @@#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)#define TARGET_SOCK_TYPE_MASK 0xf/* Covers up to TARGET_SOCK_MAX-1. */ #elif defined(TARGET_HPPA ) -#include <hppa/sockbits.h> +#include "hppa/sockbits.h" #else #if defined(TARGET_SPARC )
I think it's not a good idea to change indentation, by adding spaces you hide the real changes that are in fact simple:
linux-user/hppa/sockbits.h line 72
Quoted 13 lines
linux-user/hppa/sockbits.h +7
-0@@ -63,10 +63,16 @@#define TARGET_SO_ATTACH_REUSEPORT_EBPF 0x402D#define TARGET_SO_CNX_ADVICE 0x402E +#define TARGET_SCM_TIMESTAMPING_OPT_STATS 0x402F +#define TARGET_SO_MEMINFO 0x4030 +#define TARGET_SO_INCOMING_NAPI_ID 0x4031 +#define TARGET_SO_COOKIE 0x4032 +#define TARGET_SCM_TIMESTAMPING_PKTINFO 0x4033 +#define TARGET_SO_PEERGROUPS 0x4034 +#define TARGET_SO_ZEROCOPY 0x4035
This part is OK.
linux-user/hppa/sockbits.h
Quoted 3 lines
linux-user/hppa/sockbits.h +0
-1/** sock_type - Socket types - default values * -*
Why do you remove this line?
linux-user/socket.h line 209
Quoted 13 lines
linux-user/hppa/sockbits.h +0
-0* @SOCK_STREAM - stream (connection) socket * @SOCK_DGRAM - datagram (conn.less) socket * @SOCK_RAW - raw socket linux-user/socket.h +1
-1@@ -206,7 +206,7 @@#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)#define TARGET_SOCK_TYPE_MASK 0xf/* Covers up to TARGET_SOCK_MAX-1. */ #elif defined(TARGET_HPPA ) -#include <hppa/sockbits.h> +#include "hppa/sockbits.h"
Seems right, but it should be better to also explain in the commit message why you do that.
linux-user/socket.h line 212
Quoted 3 lines
linux-user/socket.h +0
-0#else #if defined(TARGET_SPARC )
Thanks,
Laurent
Re: [Qemu-devel] [RFC 1/6] linux-user: update hppa sockbits
Quoted 6 lines · Laurent Vivier
Quoted 1 line · Carlo Marcelo Arenas Belón
updated to match
arch/parisc/include/uapi/asm/socket.hfrom linux 4.14I think it's not a good idea to change indentation, by adding spaces you hide the real changes that are in fact simple:
would you rather have all reformatting be done in an independent patch on the series, or maybe even done completely independently after it is merged as part of the trivial patches flow?
Quoted 6 lines
/**
sock_type- Socket types - default valuesQuoted 2 lines
*
- *Why do you remove this line?
It is just an unnecessary empty line; probably a leftover of the copy/paste that was done originally (removing the arch specific comment) when this file got created. In that same line, probably should have also removed the "default values" comment.
in a more important note, it adds extra noise when looking for differences between different archs.
just now made me notice I added an extra line between the comment and the enum definition for sparc and alpha which is also inconsistent. any preference?
Carlo
RFC 2/6 linux-user: refactor socket.h for alpha
In reply to Carlo Marcelo Arenas Belónbased on fresh bits from linux 4.14 and therefore enabling SO_REUSEPORT as a side effect
--- linux-user/alpha/sockbits.h | 104 ++++++++++++++++++++++++++++++++++++++++++++ linux-user/socket.h | 104 +------------------------------------------- 2 files changed, 105 insertions(+), 103 deletions(-) create mode 100644 linux-user/alpha/sockbits.h
linux-user/alpha/sockbits.h new file +104 -0
@@ -0,0 +1,104 @@ +#define TARGET_SOL_SOCKET 0xffff + +#define TARGET_SO_DEBUG 0x0001 +#define TARGET_SO_REUSEADDR 0x0004 +#define TARGET_SO_KEEPALIVE 0x0008 +#define TARGET_SO_DONTROUTE 0x0010 +#define TARGET_SO_BROADCAST 0x0020 +#define TARGET_SO_LINGER 0x0080 +#define TARGET_SO_OOBINLINE 0x0100 +#define TARGET_SO_REUSEPORT 0x0200 +#define TARGET_SO_TYPE 0x1008 +#define TARGET_SO_ERROR 0x1007 +#define TARGET_SO_SNDBUF 0x1001 +#define TARGET_SO_RCVBUF 0x1002 +#define TARGET_SO_SNDBUFFORCE 0x100a +#define TARGET_SO_RCVBUFFORCE 0x100b +#define TARGET_SO_RCVLOWAT 0x1010 +#define TARGET_SO_SNDLOWAT 0x1011 +#define TARGET_SO_RCVTIMEO 0x1012 +#define TARGET_SO_SNDTIMEO 0x1013 +#define TARGET_SO_ACCEPTCONN 0x1014 +#define TARGET_SO_PROTOCOL 0x1028 +#define TARGET_SO_DOMAIN 0x1029 +#define TARGET_SO_NO_CHECK 11 +#define TARGET_SO_PRIORITY 12 +#define TARGET_SO_BSDCOMPAT 14 +#define TARGET_SO_PASSCRED 17 +#define TARGET_SO_PEERCRED 18 +#define TARGET_SO_BINDTODEVICE 25 +#define TARGET_SO_ATTACH_FILTER 26 +#define TARGET_SO_DETACH_FILTER 27 +#define TARGET_SO_GET_FILTER TARGET_SO_ATTACH_FILTER +#define TARGET_SO_PEERNAME 28 +#define TARGET_SO_TIMESTAMP 29 +#define TARGET_SCM_TIMESTAMP TARGET_SO_TIMESTAMP +#define TARGET_SO_PEERSEC 30 +#define TARGET_SO_PASSSEC 34 +#define TARGET_SO_TIMESTAMPNS 35 +#define TARGET_SCM_TIMESTAMPNS TARGET_SO_TIMESTAMPNS +#define TARGET_SO_SECURITY_AUTHENTICATION 19 +#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 20 +#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 21 +#define TARGET_SO_MARK 36 +#define TARGET_SO_TIMESTAMPING 37 +#define TARGET_SCM_TIMESTAMPING TARGET_SO_TIMESTAMPING +#define TARGET_SO_RXQ_OVFL 40 +#define TARGET_SO_WIFI_STATUS 41 +#define TARGET_SCM_WIFI_STATUS TARGET_SO_WIFI_STATUS +#define TARGET_SO_PEEK_OFF 42 +#define TARGET_SO_NOFCS 43 +#define TARGET_SO_LOCK_FILTER 44 +#define TARGET_SO_SELECT_ERR_QUEUE 45 +#define TARGET_SO_BUSY_POLL 46 +#define TARGET_SO_MAX_PACING_RATE 47 +#define TARGET_SO_BPF_EXTENSIONS 48 +#define TARGET_SO_INCOMING_CPU 49 +#define TARGET_SO_ATTACH_BPF 50 +#define TARGET_SO_DETACH_BPF TARGET_SO_DETACH_FILTER +#define TARGET_SO_ATTACH_REUSEPORT_CBPF 51 +#define TARGET_SO_ATTACH_REUSEPORT_EBPF 52 +#define TARGET_SO_CNX_ADVICE 53 +#define TARGET_SCM_TIMESTAMPING_OPT_STATS 54 +#define TARGET_SO_MEMINFO 55 +#define TARGET_SO_INCOMING_NAPI_ID 56 +#define TARGET_SO_COOKIE 57 +#define TARGET_SCM_TIMESTAMPING_PKTINFO 58 +#define TARGET_SO_PEERGROUPS 59 +#define TARGET_SO_ZEROCOPY 60 + +/** 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_STREAM - stream (connection) socket +* @SOCK_DGRAM - datagram (conn.less) 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. +*/ + +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 =0x40000000 , +}; + +#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1) +#define TARGET_SOCK_TYPE_MASK 0xf/* Covers up to TARGET_SOCK_MAX - 1. */ + +#define ARCH_HAS_SOCKET_TYPES 1
linux-user/socket.h +1 -103
110 lines not on this page · raw message
Signature · 1 line
2.14.1
Re: [Qemu-devel] [RFC 2/6] linux-user: refactor socket.h for alpha
Le 22/09/2017 à 16:02, Carlo Marcelo Arenas Belón a écrit :
Quoted 16 lines
based on fresh bits from linux 4.14 and therefore enabling
SO_REUSEPORTas a side effectSigned-off-by Carlo Marcelo Arenas Belón <[email protected]>--- linux-user/alpha/sockbits.h | 104 ++++++++++++++++++++++++++++++++++++++++++++ linux-user/socket.h | 104 +------------------------------------------- 2 files changed, 105 insertions(+), 103 deletions(-) create mode 100644 linux-user/alpha/sockbits.hlinux-user/alpha/sockbits.h new file +0
-0@@ -0,0 +1,104 @@
...
linux-user/alpha/sockbits.h line 98
Quoted 10 lines
linux-user/alpha/sockbits.h new file +10
-0+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 =0x40000000 ,
You change the value of TARGET_SOCK_NONBLOCK, it's correct but you should say that in the commit messages.
...
linux-user/alpha/sockbits.h
Quoted 11 lines
linux-user/alpha/sockbits.h new file +0
-11-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 , - };
Thanks,
Laurent
RFC 3/6 linux-user: refactor socket.h for mips
In reply to Carlo Marcelo Arenas Belónfresh bits from linux 4.14, redefine SO_STYLE and {SO,SCM}_TIMESTAMP to the target values and enables SO_REUSEPORT
--- linux-user/mips/sockbits.h | 107 +++++++++++++++++++++++++++++++++++++++++++++ linux-user/socket.h | 103 +------------------------------------------ 2 files changed, 108 insertions(+), 102 deletions(-) create mode 100644 linux-user/mips/sockbits.h
linux-user/mips/sockbits.h new file +107 -0
@@ -0,0 +1,107 @@ +#define TARGET_SOL_SOCKET 0xffff + +#define TARGET_SO_DEBUG 0x0001/* Record debugging information. */ +#define TARGET_SO_REUSEADDR 0x0004/* Allow reuse of local addresses. */ +#define TARGET_SO_KEEPALIVE 0x0008/* Keep connections alive and send +SIGPIPE when they die. */ +#define TARGET_SO_DONTROUTE 0x0010/* Don't do local routing. */ +#define TARGET_SO_BROADCAST 0x0020/* Allow transmission of +broadcast messages. */ +#define TARGET_SO_LINGER 0x0080/* Block on close of a reliable +socket to transmit pending data. */ +#define TARGET_SO_OOBINLINE 0x0100/* Receive out-of-band data in-band. */ +#define TARGET_SO_REUSEPORT 0x0200/* Allow local address and port reuse. */ +#define TARGET_SO_TYPE 0x1008/* Compatible name for TARGET_SO_STYLE. */ +#define TARGET_SO_STYLE TARGET_SO_TYPE/* Synonym */ +#define TARGET_SO_ERROR 0x1007/* get error status and clear */ +#define TARGET_SO_SNDBUF 0x1001/* Send buffer size. */ +#define TARGET_SO_RCVBUF 0x1002/* Receive buffer. */ +#define TARGET_SO_SNDLOWAT 0x1003/* send low-water mark */ +#define TARGET_SO_RCVLOWAT 0x1004/* receive low-water mark */ +#define TARGET_SO_SNDTIMEO 0x1005/* send timeout */ +#define TARGET_SO_RCVTIMEO 0x1006/* receive timeout */ +#define TARGET_SO_ACCEPTCONN 0x1009 +#define TARGET_SO_PROTOCOL 0x1028/* protocol type */ +#define TARGET_SO_DOMAIN 0x1029/* domain/socket family */ +#define TARGET_SO_NO_CHECK 11 +#define TARGET_SO_PRIORITY 12 +#define TARGET_SO_BSDCOMPAT 14 +#define TARGET_SO_PASSCRED 17 +#define TARGET_SO_PEERCRED 18 +#define TARGET_SO_SECURITY_AUTHENTICATION 22 +#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 23 +#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 24 +#define TARGET_SO_BINDTODEVICE 25 +#define TARGET_SO_ATTACH_FILTER 26 +#define TARGET_SO_DETACH_FILTER 27 +#define TARGET_SO_GET_FILTER TARGET_SO_ATTACH_FILTER +#define TARGET_SO_PEERNAME 28 +#define TARGET_SO_TIMESTAMP 29 +#define TARGET_SCM_TIMESTAMP TARGET_SO_TIMESTAMP +#define TARGET_SO_PEERSEC 30 +#define TARGET_SO_SNDBUFFORCE 31 +#define TARGET_SO_RCVBUFFORCE 33 +#define TARGET_SO_PASSSEC 34 +#define TARGET_SO_TIMESTAMPNS 35 +#define TARGET_SCM_TIMESTAMPNS TARGET_SO_TIMESTAMPNS +#define TARGET_SO_MARK 36 +#define TARGET_SO_TIMESTAMPING 37 +#define TARGET_SCM_TIMESTAMPING TARGET_SO_TIMESTAMPING +#define TARGET_SO_RXQ_OVFL 40 +#define TARGET_SO_WIFI_STATUS 41 +#define TARGET_SCM_WIFI_STATUS TARGET_SO_WIFI_STATUS +#define TARGET_SO_PEEK_OFF 42 +#define TARGET_SO_NOFCS 43 +#define TARGET_SO_LOCK_FILTER 44 +#define TARGET_SO_SELECT_ERR_QUEUE 45 +#define TARGET_SO_BUSY_POLL 46 +#define TARGET_SO_MAX_PACING_RATE 47 +#define TARGET_SO_BPF_EXTENSIONS 48 +#define TARGET_SO_INCOMING_CPU 49 +#define TARGET_SO_ATTACH_BPF 50 +#define TARGET_SO_DETACH_BPF TARGET_SO_DETACH_FILTER +#define TARGET_SO_ATTACH_REUSEPORT_CBPF 51 +#define TARGET_SO_ATTACH_REUSEPORT_EBPF 52 +#define TARGET_SO_CNX_ADVICE 53 +#define TARGET_SCM_TIMESTAMPING_OPT_STATS 54 +#define TARGET_SO_MEMINFO 55 +#define TARGET_SO_INCOMING_NAPI_ID 56 +#define TARGET_SO_COOKIE 57 +#define TARGET_SCM_TIMESTAMPING_PKTINFO 58 +#define TARGET_SO_PEERGROUPS 59 +#define TARGET_SO_ZEROCOPY 60 + +/** sock_type - Socket types +* +* Please notice that for binary compat reasons MIPS 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. +*/ +enum sock_type { +TARGET_SOCK_DGRAM =1 , +TARGET_SOCK_STREAM =2 , +TARGET_SOCK_RAW =3 , +TARGET_SOCK_RDM =4 , +TARGET_SOCK_SEQPACKET =5 , +TARGET_SOCK_DCCP =6 , +TARGET_SOCK_PACKET =10 , +TARGET_SOCK_CLOEXEC =02000000 , +TARGET_SOCK_NONBLOCK =0x0080 , +}; + +#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1) +#define TARGET_SOCK_TYPE_MASK 0xf/* Covers up to TARGET_SOCK_MAX - 1. */ + +#define ARCH_HAS_SOCKET_TYPES 1
linux-user/socket.h +1 -102
107 lines not on this page · raw message
Signature · 1 line
2.14.1
Re: [Qemu-devel] [RFC 3/6] linux-user: refactor socket.h for mips
Le 22/09/2017 à 16:02, Carlo Marcelo Arenas Belón a écrit :
Quoted 2 lines
fresh bits from linux 4.14, redefine
SO_STYLEand {SO,SCM}_TIMESTAMP to the target values and enablesSO_REUSEPORT
And you fix TARGET_SOCK_NONBLOCK value.
RFC 4/6 linux-user: refactor socket.h for sparc
In reply to Carlo Marcelo Arenas Belónfixes SOL_SOCKET and SO_LINGER at least
--- linux-user/socket.h | 46 ++------------------ linux-user/sparc/sockbits.h | 104 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+), 43 deletions(-) create mode 100644 linux-user/sparc/sockbits.h
linux-user/socket.h +3 -43
@@ -4,50 +4,10 @@#include "alpha/sockbits.h" #elif defined(TARGET_HPPA )#include "hppa/sockbits.h" +#elif defined(TARGET_SPARC ) +#include "sparc/sockbits.h" #else -#if defined(TARGET_SPARC ) -/** 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. -*/ - -#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 =020000000 , -TARGET_SOCK_NONBLOCK =040000 , - }; - -#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1) -#define TARGET_SOCK_TYPE_MASK 0xf/* Covers up to TARGET_SOCK_MAX-1. */ - -#define TARGET_SO_PASSSEC 31 -#else -#define TARGET_SO_PASSSEC 34 -#endif -/* For setsockopt(2) */ #define TARGET_SOL_SOCKET 1
@@ -103,11 +63,11 @@#define TARGET_SO_PEERSEC 31 +#define TARGET_SO_PASSSEC 34#endif #ifndef ARCH_HAS_SOCKET_TYPES /** sock_type - Socket types - default values -* * * @SOCK_STREAM - stream (connection) socket * @SOCK_DGRAM - datagram (conn.less) socket
linux-user/sparc/sockbits.h new file +104 -0
104 lines not on this page · raw message
Signature · 1 line
2.14.1
Re: [Qemu-devel] [RFC 4/6] linux-user: refactor socket.h for sparc
Le 22/09/2017 à 16:02, Carlo Marcelo Arenas Belón a écrit :
Quoted 1 line
fixes
SOL_SOCKETandSO_LINGERat least
And fix TARGET_SOCK_NONBLOCK and TARGET_SOCK_CLOEXEC values.
Quoted 53 lines
Signed-off-by Carlo Marcelo Arenas Belón <[email protected]>--- linux-user/socket.h | 46 ++------------------ linux-user/sparc/sockbits.h | 104 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+), 43 deletions(-) create mode 100644 linux-user/sparc/sockbits.hlinux-user/socket.h +2
-33@@ -4,50 +4,10 @@#include "alpha/sockbits.h" #elif defined(TARGET_HPPA )#include "hppa/sockbits.h" +#elif defined(TARGET_SPARC ) +#include "sparc/sockbits.h" #else -#if defined(TARGET_SPARC ) -/** 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. -*/ - -#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 =020000000 , -TARGET_SOCK_NONBLOCK =040000 , - };
...
Quoted 7 lines
linux-user/socket.h +6
-0+enum sock_type { +TARGET_SOCK_STREAM =1 , +TARGET_SOCK_DGRAM =2 , +TARGET_SOCK_RAW =3 , +TARGET_SOCK_RDM =4 , +TARGET_SOCK_SEQPACKET =5 ,
linux-user/socket.h
Quoted 10 lines
linux-user/socket.h +10
-0+TARGET_SOCK_DCCP =6 , +TARGET_SOCK_PACKET =10 , +TARGET_SOCK_CLOEXEC =0x400000 , + TARGET_SOCK_NONBLOCK = 0x4000, +}; + +#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1) +#define TARGET_SOCK_TYPE_MASK 0xf/* Covers up to TARGET_SOCK_MAX - 1. */ + +#define ARCH_HAS_SOCKET_TYPES 1
RFC 5/6 linux-user: fix 64bit versions of sparc and mips
In reply to Carlo Marcelo Arenas Belón--- linux-user/mips64/sockbits.h | 1 + linux-user/socket.h | 4 ++-- linux-user/sparc64/sockbits.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 linux-user/mips64/sockbits.h create mode 100644 linux-user/sparc64/sockbits.h
linux-user/mips64/sockbits.h new file +1 -0
@@ -0,0 +1 @@ +#include "../mips/sockbits.h"
linux-user/socket.h +2 -2
@@ -1,10 +1,10 @@ -#if defined(TARGET_MIPS ) +#if defined(TARGET_MIPS ) || defined(TARGET_MIPS64 )#include "mips/sockbits.h" #elif defined(TARGET_ALPHA )#include "alpha/sockbits.h" #elif defined(TARGET_HPPA )#include "hppa/sockbits.h" -#elif defined(TARGET_SPARC ) +#elif defined(TARGET_SPARC ) || defined(TARGET_SPARC64 )#include "sparc/sockbits.h" #else
linux-user/sparc64/sockbits.h new file +1 -0
@@ -0,0 +1 @@ +#include "../sparc/sockbits.h"
Signature · 1 line
2.14.1
Re: [Qemu-devel] [RFC 5/6] linux-user: fix 64bit versions of sparc and mips
Le 22/09/2017 à 16:02, Carlo Marcelo Arenas Belón a écrit :
Quoted 5 lines
Signed-off-by Carlo Marcelo Arenas Belón <[email protected]>--- linux-user/mips64/sockbits.h | 1 + linux-user/socket.h | 4 ++-- linux-user/sparc64/sockbits.h | 1 +
Who includes the two new files?
Moreover TARGET_MIPS/TARGET_SPARC (base arch) are always defined when TARGET_MIPS64/TARGET_SPARC64 (target arch) are defined.
So I think this patch is useless.
Thanks,
Laurent
Quoted 36 lines
3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 linux-user/mips64/sockbits.h create mode 100644 linux-user/sparc64/sockbits.hlinux-user/mips64/sockbits.h new file +1
-0@@ -0,0 +1 @@ +#include "../mips/sockbits.h" linux-user/socket.h +2
-2@@ -1,10 +1,10 @@ -#if defined(TARGET_MIPS ) +#if defined(TARGET_MIPS ) || defined(TARGET_MIPS64 )#include "mips/sockbits.h" #elif defined(TARGET_ALPHA )#include "alpha/sockbits.h" #elif defined(TARGET_HPPA )#include "hppa/sockbits.h" -#elif defined(TARGET_SPARC ) +#elif defined(TARGET_SPARC ) || defined(TARGET_SPARC64 )#include "sparc/sockbits.h" #else linux-user/sparc64/sockbits.h new file +1
-0@@ -0,0 +1 @@ +#include "../sparc/sockbits.h"
Re: [Qemu-devel] [RFC 5/6] linux-user: fix 64bit versions of sparc and mips
Quoted 9 lines · Laurent Vivier
Quoted 5 lines · Carlo Marcelo Arenas Belón
Signed-off-by Carlo Marcelo Arenas Belón <[email protected]>--- linux-user/mips64/sockbits.h | 1 + linux-user/socket.h | 4 ++-- linux-user/sparc64/sockbits.h | 1 +Who includes the two new files?
No one yet, but hopefully will make clearer to anyone looking later for arch specific values that they were indeed equivalent to their non 64bit versions.
It also mimics what termbits.h is doing and so might allow in the future to drop the common socket.h for an arch specific one, which will be easier to maintain and keep in sync with the linux kernel.
Quoted 5 lines
Moreover TARGET_MIPS/TARGET_SPARC (base arch) are always defined when TARGET_MIPS64/TARGET_SPARC64 (target arch) are defined.
So I think this patch is useless.
ok, glad to know I was wrong about those architectures being broken, still suspect s390x is though, but don't want to address this in this series, like I didn't want to include the bigger refactoring explained above.
I am curious also over users of those architectures and their suggestions, which is why I sent this series as an RFC; is there a better forum for that somewhere else?
Carlo
RFC 6/6 linux-user: update default socket.h
In reply to Carlo Marcelo Arenas Belón* enable SO_REUSEPORT as a sideeffect and add SO_GET_FILTER alias
* make sure 64bit version for ppc is also supported
--- linux-user/socket.h | 61 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 12 deletions(-)
linux-user/socket.h +49 -12
@@ -27,8 +27,8 @@#define TARGET_SO_PRIORITY 12#define TARGET_SO_LINGER 13#define TARGET_SO_BSDCOMPAT 14 -/* To add :#define TARGET_SO_REUSEPORT 15 */ -#if defined(TARGET_PPC ) +#define TARGET_SO_REUSEPORT 15 +#if defined(TARGET_PPC ) || defined(TARGET_PPC64 )#define TARGET_SO_RCVLOWAT 16#define TARGET_SO_SNDLOWAT 17#define TARGET_SO_RCVTIMEO 18
@@ -49,21 +49,58 @@#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 23#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 24 -#define TARGET_SO_BINDTODEVICE 25 +#define TARGET_SO_BINDTODEVICE 25/* Socket filtering */ -#define TARGET_SO_ATTACH_FILTER 26 -#define TARGET_SO_DETACH_FILTER 27 +#define TARGET_SO_ATTACH_FILTER 26 +#define TARGET_SO_DETACH_FILTER 27 +#define TARGET_SO_GET_FILTER TARGET_SO_ATTACH_FILTER -#define TARGET_SO_PEERNAME 28 -#define TARGET_SO_TIMESTAMP 29 -#define TARGET_SCM_TIMESTAMP TARGET_SO_TIMESTAMP +#define TARGET_SO_PEERNAME 28 +#define TARGET_SO_TIMESTAMP 29 +#define TARGET_SCM_TIMESTAMP TARGET_SO_TIMESTAMP -#define TARGET_SO_ACCEPTCONN 30 +#define TARGET_SO_ACCEPTCONN 30 -#define TARGET_SO_PEERSEC 31 +#define TARGET_SO_PEERSEC 31 +#define TARGET_SO_PASSSEC 34 +#define TARGET_SO_TIMESTAMPNS 35 +#define TARGET_SCM_TIMESTAMPNS TARGET_SO_TIMESTAMPNS + +#define TARGET_SO_MARK 36 + +#define TARGET_SO_TIMESTAMPING 37 +#define TARGET_SCM_TIMESTAMPING TARGET_SO_TIMESTAMPING + +#define TARGET_SO_PROTOCOL 38 +#define TARGET_SO_DOMAIN 39 + +#define TARGET_SO_RXQ_OVFL 40 + +#define TARGET_SO_WIFI_STATUS 41 +#define TARGET_SCM_WIFI_STATUS TARGET_SO_WIFI_STATUS +#define TARGET_SO_PEEK_OFF 42 + +#define TARGET_SO_NOFCS 43 +#define TARGET_SO_LOCK_FILTER 44 +#define TARGET_SO_SELECT_ERR_QUEUE 45 +#define TARGET_SO_BUSY_POLL 46 +#define TARGET_SO_MAX_PACING_RATE 47 +#define TARGET_SO_BPF_EXTENSIONS 48 +#define TARGET_SO_INCOMING_CPU 49 +#define TARGET_SO_ATTACH_BPF 50 +#define TARGET_SO_DETACH_BPF TARGET_SO_DETACH_FILTER +#define TARGET_SO_ATTACH_REUSEPORT_CBPF 51 +#define TARGET_SO_ATTACH_REUSEPORT_EBPF 52 +#define TARGET_SO_CNX_ADVICE 53 +#define TARGET_SCM_TIMESTAMPING_OPT_STATS 54 +#define TARGET_SO_MEMINFO 55 +#define TARGET_SO_INCOMING_NAPI_ID 56 +#define TARGET_SO_COOKIE 57 +#define TARGET_SCM_TIMESTAMPING_PKTINFO 58 +#define TARGET_SO_PEERGROUPS 59 +#define TARGET_SO_ZEROCOPY 60 -#define TARGET_SO_PASSSEC 34#endif #ifndef ARCH_HAS_SOCKET_TYPES
@@ -94,6 +131,6 @@ };#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1) -#define TARGET_SOCK_TYPE_MASK 0xf/* Covers up to TARGET_SOCK_MAX-1. */ +#define TARGET_SOCK_TYPE_MASK 0xf/* Covers up to TARGET_SOCK_MAX - 1. */ #endif
Signature · 1 line
2.14.1
Re: [Qemu-devel] [RFC 6/6] linux-user: update default socket.h
Le 22/09/2017 à 16:02, Carlo Marcelo Arenas Belón a écrit :
Quoted 2 lines
* enable
SO_REUSEPORTas a sideeffect and addSO_GET_FILTERalias
* make sure 64bit version for ppc is also supported
As previously TARGET_PPC64 is not needed.
And you should move powerpc bits to linux-user/ppc/sockbits.h
Thanks,
Laurent
Quoted 97 lines
Signed-off-by Carlo Marcelo Arenas Belón <[email protected]>--- linux-user/socket.h | 61 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 12 deletions(-)linux-user/socket.h +49
-12@@ -27,8 +27,8 @@#define TARGET_SO_PRIORITY 12#define TARGET_SO_LINGER 13#define TARGET_SO_BSDCOMPAT 14 -/* To add :#define TARGET_SO_REUSEPORT 15 */ -#if defined(TARGET_PPC ) +#define TARGET_SO_REUSEPORT 15 +#if defined(TARGET_PPC ) || defined(TARGET_PPC64 )#define TARGET_SO_RCVLOWAT 16#define TARGET_SO_SNDLOWAT 17#define TARGET_SO_RCVTIMEO 18@@ -49,21 +49,58 @@#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 23#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 24 -#define TARGET_SO_BINDTODEVICE 25 +#define TARGET_SO_BINDTODEVICE 25/* Socket filtering */ -#define TARGET_SO_ATTACH_FILTER 26 -#define TARGET_SO_DETACH_FILTER 27 +#define TARGET_SO_ATTACH_FILTER 26 +#define TARGET_SO_DETACH_FILTER 27 +#define TARGET_SO_GET_FILTER TARGET_SO_ATTACH_FILTER -#define TARGET_SO_PEERNAME 28 -#define TARGET_SO_TIMESTAMP 29 -#define TARGET_SCM_TIMESTAMP TARGET_SO_TIMESTAMP +#define TARGET_SO_PEERNAME 28 +#define TARGET_SO_TIMESTAMP 29 +#define TARGET_SCM_TIMESTAMP TARGET_SO_TIMESTAMP -#define TARGET_SO_ACCEPTCONN 30 +#define TARGET_SO_ACCEPTCONN 30 -#define TARGET_SO_PEERSEC 31 +#define TARGET_SO_PEERSEC 31 +#define TARGET_SO_PASSSEC 34 +#define TARGET_SO_TIMESTAMPNS 35 +#define TARGET_SCM_TIMESTAMPNS TARGET_SO_TIMESTAMPNS + +#define TARGET_SO_MARK 36 + +#define TARGET_SO_TIMESTAMPING 37 +#define TARGET_SCM_TIMESTAMPING TARGET_SO_TIMESTAMPING + +#define TARGET_SO_PROTOCOL 38 +#define TARGET_SO_DOMAIN 39 + +#define TARGET_SO_RXQ_OVFL 40 + +#define TARGET_SO_WIFI_STATUS 41 +#define TARGET_SCM_WIFI_STATUS TARGET_SO_WIFI_STATUS +#define TARGET_SO_PEEK_OFF 42 + +#define TARGET_SO_NOFCS 43 +#define TARGET_SO_LOCK_FILTER 44 +#define TARGET_SO_SELECT_ERR_QUEUE 45 +#define TARGET_SO_BUSY_POLL 46 +#define TARGET_SO_MAX_PACING_RATE 47 +#define TARGET_SO_BPF_EXTENSIONS 48 +#define TARGET_SO_INCOMING_CPU 49 +#define TARGET_SO_ATTACH_BPF 50 +#define TARGET_SO_DETACH_BPF TARGET_SO_DETACH_FILTER +#define TARGET_SO_ATTACH_REUSEPORT_CBPF 51 +#define TARGET_SO_ATTACH_REUSEPORT_EBPF 52 +#define TARGET_SO_CNX_ADVICE 53 +#define TARGET_SCM_TIMESTAMPING_OPT_STATS 54 +#define TARGET_SO_MEMINFO 55 +#define TARGET_SO_INCOMING_NAPI_ID 56 +#define TARGET_SO_COOKIE 57 +#define TARGET_SCM_TIMESTAMPING_PKTINFO 58 +#define TARGET_SO_PEERGROUPS 59 +#define TARGET_SO_ZEROCOPY 60 -#define TARGET_SO_PASSSEC 34#endif #ifndef ARCH_HAS_SOCKET_TYPES @@ -94,6 +131,6 @@ };#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1) -#define TARGET_SOCK_TYPE_MASK 0xf/* Covers up to TARGET_SOCK_MAX-1. */ +#define TARGET_SOCK_TYPE_MASK 0xf/* Covers up to TARGET_SOCK_MAX - 1. */ #endif
Re: [Qemu-devel] [RFC 6/6] linux-user: update default socket.h
Quoted 1 line · Laurent Vivier
And you should move powerpc bits to linux-user/ppc/sockbits.
PPC is IMHO a special case, since it is kept together with the generic header in the linux kernel (except for a similar exception to those few values that differ) as you can see in :
http://elixir.free-electrons.com/linux/latest/source/arch/powerpc/include/uapi/asm/socket.h
breaking it up into his own file will probably only make it more difficult to maintain
Carlo