* [Qemu-devel] [RFC 0/6] linux-user: refactor socket.h into architecture specific sockbits
@ 2017-09-22 14:02 Carlo Marcelo Arenas Belón
2017-09-22 14:02 ` [Qemu-devel] [RFC 1/6] linux-user: update hppa sockbits Carlo Marcelo Arenas Belón
` (5 more replies)
0 siblings, 6 replies; 16+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2017-09-22 14:02 UTC (permalink / raw)
To: qemu-devel; +Cc: rth, laurent, riku.voipio
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.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Qemu-devel] [RFC 1/6] linux-user: update hppa sockbits
2017-09-22 14:02 [Qemu-devel] [RFC 0/6] linux-user: refactor socket.h into architecture specific sockbits Carlo Marcelo Arenas Belón
@ 2017-09-22 14:02 ` Carlo Marcelo Arenas Belón
2017-09-22 16:13 ` Laurent Vivier
2017-09-22 14:02 ` [Qemu-devel] [RFC 2/6] linux-user: refactor socket.h for alpha Carlo Marcelo Arenas Belón
` (4 subsequent siblings)
5 siblings, 1 reply; 16+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2017-09-22 14:02 UTC (permalink / raw)
To: qemu-devel; +Cc: rth, laurent, riku.voipio, Carlo Marcelo Arenas Belón
updated to match arch/parisc/include/uapi/asm/socket.h from linux 4.14
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
linux-user/hppa/sockbits.h | 148 +++++++++++++++++++++++----------------------
linux-user/socket.h | 2 +-
2 files changed, 78 insertions(+), 72 deletions(-)
diff --git a/linux-user/hppa/sockbits.h b/linux-user/hppa/sockbits.h
index 5044619e16..3dab31a76a 100644
--- a/linux-user/hppa/sockbits.h
+++ b/linux-user/hppa/sockbits.h
@@ -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
diff --git a/linux-user/socket.h b/linux-user/socket.h
index 7051cd2cf4..c7e6cb8ea1 100644
--- a/linux-user/socket.h
+++ b/linux-user/socket.h
@@ -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)
--
2.14.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Qemu-devel] [RFC 2/6] linux-user: refactor socket.h for alpha
2017-09-22 14:02 [Qemu-devel] [RFC 0/6] linux-user: refactor socket.h into architecture specific sockbits Carlo Marcelo Arenas Belón
2017-09-22 14:02 ` [Qemu-devel] [RFC 1/6] linux-user: update hppa sockbits Carlo Marcelo Arenas Belón
@ 2017-09-22 14:02 ` Carlo Marcelo Arenas Belón
2017-09-22 16:30 ` Laurent Vivier
2017-09-22 14:02 ` [Qemu-devel] [RFC 3/6] linux-user: refactor socket.h for mips Carlo Marcelo Arenas Belón
` (3 subsequent siblings)
5 siblings, 1 reply; 16+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2017-09-22 14:02 UTC (permalink / raw)
To: qemu-devel; +Cc: rth, laurent, riku.voipio, Carlo Marcelo Arenas Belón
based on fresh bits from linux 4.14 and therefore enabling SO_REUSEPORT
as a side effect
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
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
diff --git a/linux-user/alpha/sockbits.h b/linux-user/alpha/sockbits.h
new file mode 100644
index 0000000000..768579a1f7
--- /dev/null
+++ b/linux-user/alpha/sockbits.h
@@ -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
diff --git a/linux-user/socket.h b/linux-user/socket.h
index c7e6cb8ea1..115bdf2ddb 100644
--- a/linux-user/socket.h
+++ b/linux-user/socket.h
@@ -102,109 +102,7 @@
#define TARGET_SOCK_TYPE_MASK 0xf /* Covers up to TARGET_SOCK_MAX-1. */
#elif defined(TARGET_ALPHA)
-
- /* For setsockopt(2) */
- #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
- /* To add :#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
-
- /* linux-specific, might as well be the same as on i386 */
- #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
-
- /* Socket filtering */
- #define TARGET_SO_ATTACH_FILTER 26
- #define TARGET_SO_DETACH_FILTER 27
-
- #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
-
- /* Security levels - as per NRL IPv6 - don't actually do anything */
- #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
-
- /* 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.
- */
-
- #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,
- };
-
- #define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
- #define TARGET_SOCK_TYPE_MASK 0xf /* Covers up to TARGET_SOCK_MAX-1. */
+#include "alpha/sockbits.h"
#elif defined(TARGET_HPPA)
#include "hppa/sockbits.h"
#else
--
2.14.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Qemu-devel] [RFC 3/6] linux-user: refactor socket.h for mips
2017-09-22 14:02 [Qemu-devel] [RFC 0/6] linux-user: refactor socket.h into architecture specific sockbits Carlo Marcelo Arenas Belón
2017-09-22 14:02 ` [Qemu-devel] [RFC 1/6] linux-user: update hppa sockbits Carlo Marcelo Arenas Belón
2017-09-22 14:02 ` [Qemu-devel] [RFC 2/6] linux-user: refactor socket.h for alpha Carlo Marcelo Arenas Belón
@ 2017-09-22 14:02 ` Carlo Marcelo Arenas Belón
2017-09-22 16:41 ` Laurent Vivier
2017-09-22 14:02 ` [Qemu-devel] [RFC 4/6] linux-user: refactor socket.h for sparc Carlo Marcelo Arenas Belón
` (2 subsequent siblings)
5 siblings, 1 reply; 16+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2017-09-22 14:02 UTC (permalink / raw)
To: qemu-devel; +Cc: rth, laurent, riku.voipio, Carlo Marcelo Arenas Belón
fresh bits from linux 4.14, redefine SO_STYLE and {SO,SCM}_TIMESTAMP to
the target values and enables SO_REUSEPORT
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
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
diff --git a/linux-user/mips/sockbits.h b/linux-user/mips/sockbits.h
new file mode 100644
index 0000000000..6d8ea8aba2
--- /dev/null
+++ b/linux-user/mips/sockbits.h
@@ -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
diff --git a/linux-user/socket.h b/linux-user/socket.h
index 115bdf2ddb..036270a6e4 100644
--- a/linux-user/socket.h
+++ b/linux-user/socket.h
@@ -1,106 +1,5 @@
-
#if defined(TARGET_MIPS)
- /* MIPS special values for constants */
-
- /*
- * For setsockopt(2)
- *
- * This defines are ABI conformant as far as Linux supports these ...
- */
- #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.
- */
- #if 0
- /* To add: Allow local address and port reuse. */
- #define TARGET_SO_REUSEPORT 0x0200
- #endif
-
- #define TARGET_SO_TYPE 0x1008 /* Compatible name for SO_STYLE. */
- #define TARGET_SO_STYLE 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
-
- /* linux-specific, might as well be the same as on i386 */
- #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
-
- /* Security levels - as per NRL IPv6 - don't actually do anything */
- #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
-
- /* Socket filtering */
- #define TARGET_SO_ATTACH_FILTER 26
- #define TARGET_SO_DETACH_FILTER 27
-
- #define TARGET_SO_PEERNAME 28
- #define TARGET_SO_TIMESTAMP 29
- #define SCM_TIMESTAMP SO_TIMESTAMP
-
- #define TARGET_SO_PEERSEC 30
- #define TARGET_SO_SNDBUFFORCE 31
- #define TARGET_SO_RCVBUFFORCE 33
- #define TARGET_SO_PASSSEC 34
-
- /** 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.
- */
-
- #define ARCH_HAS_SOCKET_TYPES 1
-
- 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 = 0200,
- };
-
- #define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
- #define TARGET_SOCK_TYPE_MASK 0xf /* Covers up to TARGET_SOCK_MAX-1. */
-
+#include "mips/sockbits.h"
#elif defined(TARGET_ALPHA)
#include "alpha/sockbits.h"
#elif defined(TARGET_HPPA)
--
2.14.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Qemu-devel] [RFC 4/6] linux-user: refactor socket.h for sparc
2017-09-22 14:02 [Qemu-devel] [RFC 0/6] linux-user: refactor socket.h into architecture specific sockbits Carlo Marcelo Arenas Belón
` (2 preceding siblings ...)
2017-09-22 14:02 ` [Qemu-devel] [RFC 3/6] linux-user: refactor socket.h for mips Carlo Marcelo Arenas Belón
@ 2017-09-22 14:02 ` Carlo Marcelo Arenas Belón
2017-09-22 16:51 ` Laurent Vivier
2017-09-22 14:02 ` [Qemu-devel] [RFC 5/6] linux-user: fix 64bit versions of sparc and mips Carlo Marcelo Arenas Belón
2017-09-22 14:02 ` [Qemu-devel] [RFC 6/6] linux-user: update default socket.h Carlo Marcelo Arenas Belón
5 siblings, 1 reply; 16+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2017-09-22 14:02 UTC (permalink / raw)
To: qemu-devel; +Cc: rth, laurent, riku.voipio, Carlo Marcelo Arenas Belón
fixes SOL_SOCKET and SO_LINGER at least
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
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
diff --git a/linux-user/socket.h b/linux-user/socket.h
index 036270a6e4..dfa692286b 100644
--- a/linux-user/socket.h
+++ b/linux-user/socket.h
@@ -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
diff --git a/linux-user/sparc/sockbits.h b/linux-user/sparc/sockbits.h
new file mode 100644
index 0000000000..d51ae5f84f
--- /dev/null
+++ b/linux-user/sparc/sockbits.h
@@ -0,0 +1,104 @@
+#define TARGET_SOL_SOCKET 0xffff
+
+#define TARGET_SO_DEBUG 0x0001
+#define TARGET_SO_PASSCRED 0x0002
+#define TARGET_SO_REUSEADDR 0x0004
+#define TARGET_SO_KEEPALIVE 0x0008
+#define TARGET_SO_DONTROUTE 0x0010
+#define TARGET_SO_BROADCAST 0x0020
+#define TARGET_SO_PEERCRED 0x0040
+#define TARGET_SO_LINGER 0x0080
+#define TARGET_SO_OOBINLINE 0x0100
+#define TARGET_SO_REUSEPORT 0x0200
+#define TARGET_SO_BSDCOMPAT 0x0400
+#define TARGET_SO_RCVLOWAT 0x0800
+#define TARGET_SO_SNDLOWAT 0x1000
+#define TARGET_SO_RCVTIMEO 0x2000
+#define TARGET_SO_SNDTIMEO 0x4000
+#define TARGET_SO_ACCEPTCONN 0x8000
+#define TARGET_SO_SNDBUF 0x1001
+#define TARGET_SO_RCVBUF 0x1002
+#define TARGET_SO_SNDBUFFORCE 0x100a
+#define TARGET_SO_RCVBUFFORCE 0x100b
+#define TARGET_SO_ERROR 0x1007
+#define TARGET_SO_TYPE 0x1008
+#define TARGET_SO_PROTOCOL 0x1028
+#define TARGET_SO_DOMAIN 0x1029
+#define TARGET_SO_NO_CHECK 0x000b
+#define TARGET_SO_PRIORITY 0x000c
+#define TARGET_SO_BINDTODEVICE 0x000d
+#define TARGET_SO_ATTACH_FILTER 0x001a
+#define TARGET_SO_DETACH_FILTER 0x001b
+#define TARGET_SO_GET_FILTER TARGET_SO_ATTACH_FILTER
+#define TARGET_SO_PEERNAME 0x001c
+#define TARGET_SO_TIMESTAMP 0x001d
+#define TARGET_SCM_TIMESTAMP TARGET_SO_TIMESTAMP
+#define TARGET_SO_PEERSEC 0x001e
+#define TARGET_SO_PASSSEC 0x001f
+#define TARGET_SO_TIMESTAMPNS 0x0021
+#define TARGET_SCM_TIMESTAMPNS TARGET_SO_TIMESTAMPNS
+#define TARGET_SO_MARK 0x0022
+#define TARGET_SO_TIMESTAMPING 0x0023
+#define TARGET_SCM_TIMESTAMPING TARGET_SO_TIMESTAMPING
+#define TARGET_SO_RXQ_OVFL 0x0024
+#define TARGET_SO_WIFI_STATUS 0x0025
+#define TARGET_SCM_WIFI_STATUS TARGET_SO_WIFI_STATUS
+#define TARGET_SO_PEEK_OFF 0x0026
+#define TARGET_SO_NOFCS 0x0027
+#define TARGET_SO_LOCK_FILTER 0x0028
+#define TARGET_SO_SELECT_ERR_QUEUE 0x0029
+#define TARGET_SO_BUSY_POLL 0x0030
+#define TARGET_SO_MAX_PACING_RATE 0x0031
+#define TARGET_SO_BPF_EXTENSIONS 0x0032
+#define TARGET_SO_INCOMING_CPU 0x0033
+#define TARGET_SO_ATTACH_BPF 0x0034
+#define TARGET_SO_DETACH_BPF TARGET_SO_DETACH_FILTER
+#define TARGET_SO_ATTACH_REUSEPORT_CBPF 0x0035
+#define TARGET_SO_ATTACH_REUSEPORT_EBPF 0x0036
+#define TARGET_SO_CNX_ADVICE 0x0037
+#define TARGET_SCM_TIMESTAMPING_OPT_STATS 0x0038
+#define TARGET_SO_MEMINFO 0x0039
+#define TARGET_SO_INCOMING_NAPI_ID 0x003a
+#define TARGET_SO_COOKIE 0x003b
+#define TARGET_SCM_TIMESTAMPING_PKTINFO 0x003c
+#define TARGET_SO_PEERGROUPS 0x003d
+#define TARGET_SO_ZEROCOPY 0x003e
+#define TARGET_SO_SECURITY_AUTHENTICATION 0x5001
+#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002
+#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 0x5004
+
+/** 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_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 = 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
--
2.14.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Qemu-devel] [RFC 5/6] linux-user: fix 64bit versions of sparc and mips
2017-09-22 14:02 [Qemu-devel] [RFC 0/6] linux-user: refactor socket.h into architecture specific sockbits Carlo Marcelo Arenas Belón
` (3 preceding siblings ...)
2017-09-22 14:02 ` [Qemu-devel] [RFC 4/6] linux-user: refactor socket.h for sparc Carlo Marcelo Arenas Belón
@ 2017-09-22 14:02 ` Carlo Marcelo Arenas Belón
2017-09-22 17:01 ` Laurent Vivier
2017-09-22 14:02 ` [Qemu-devel] [RFC 6/6] linux-user: update default socket.h Carlo Marcelo Arenas Belón
5 siblings, 1 reply; 16+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2017-09-22 14:02 UTC (permalink / raw)
To: qemu-devel; +Cc: rth, laurent, riku.voipio, Carlo Marcelo Arenas Belón
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
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
diff --git a/linux-user/mips64/sockbits.h b/linux-user/mips64/sockbits.h
new file mode 100644
index 0000000000..e6b6d31ac9
--- /dev/null
+++ b/linux-user/mips64/sockbits.h
@@ -0,0 +1 @@
+#include "../mips/sockbits.h"
diff --git a/linux-user/socket.h b/linux-user/socket.h
index dfa692286b..6fd486c6b1 100644
--- a/linux-user/socket.h
+++ b/linux-user/socket.h
@@ -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
diff --git a/linux-user/sparc64/sockbits.h b/linux-user/sparc64/sockbits.h
new file mode 100644
index 0000000000..658899e4d3
--- /dev/null
+++ b/linux-user/sparc64/sockbits.h
@@ -0,0 +1 @@
+#include "../sparc/sockbits.h"
--
2.14.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Qemu-devel] [RFC 6/6] linux-user: update default socket.h
2017-09-22 14:02 [Qemu-devel] [RFC 0/6] linux-user: refactor socket.h into architecture specific sockbits Carlo Marcelo Arenas Belón
` (4 preceding siblings ...)
2017-09-22 14:02 ` [Qemu-devel] [RFC 5/6] linux-user: fix 64bit versions of sparc and mips Carlo Marcelo Arenas Belón
@ 2017-09-22 14:02 ` Carlo Marcelo Arenas Belón
2017-09-22 17:04 ` Laurent Vivier
5 siblings, 1 reply; 16+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2017-09-22 14:02 UTC (permalink / raw)
To: qemu-devel; +Cc: rth, laurent, riku.voipio, 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
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
linux-user/socket.h | 61 ++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 49 insertions(+), 12 deletions(-)
diff --git a/linux-user/socket.h b/linux-user/socket.h
index 6fd486c6b1..c37c10822a 100644
--- a/linux-user/socket.h
+++ b/linux-user/socket.h
@@ -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
--
2.14.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [RFC 1/6] linux-user: update hppa sockbits
2017-09-22 14:02 ` [Qemu-devel] [RFC 1/6] linux-user: update hppa sockbits Carlo Marcelo Arenas Belón
@ 2017-09-22 16:13 ` Laurent Vivier
2017-09-25 12:40 ` Carlo Arenas
0 siblings, 1 reply; 16+ messages in thread
From: Laurent Vivier @ 2017-09-22 16:13 UTC (permalink / raw)
To: Carlo Marcelo Arenas Belón, qemu-devel; +Cc: rth, riku.voipio
Le 22/09/2017 à 16:02, Carlo Marcelo Arenas Belón a écrit :
> updated to match arch/parisc/include/uapi/asm/socket.h from linux 4.14
>
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> ---
> linux-user/hppa/sockbits.h | 148 +++++++++++++++++++++++----------------------
> linux-user/socket.h | 2 +-
> 2 files changed, 78 insertions(+), 72 deletions(-)
>
> diff --git a/linux-user/hppa/sockbits.h b/linux-user/hppa/sockbits.h
> index 5044619e16..3dab31a76a 100644
> --- a/linux-user/hppa/sockbits.h
> +++ b/linux-user/hppa/sockbits.h
> @@ -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
> diff --git a/linux-user/socket.h b/linux-user/socket.h
> index 7051cd2cf4..c7e6cb8ea1 100644
> --- a/linux-user/socket.h
> +++ b/linux-user/socket.h
> @@ -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:
> --- a/linux-user/hppa/sockbits.h
> +++ b/linux-user/hppa/sockbits.h
> @@ -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.
> /** sock_type - Socket types - default values
> *
> - *
Why do you remove this line?
> * @SOCK_STREAM - stream (connection) socket
> * @SOCK_DGRAM - datagram (conn.less) socket
> * @SOCK_RAW - raw socket
> diff --git a/linux-user/socket.h b/linux-user/socket.h
> index 7051cd2cf4..c7e6cb8ea1 100644
> --- a/linux-user/socket.h
> +++ b/linux-user/socket.h
> @@ -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.
> #else
>
> #if defined(TARGET_SPARC)
Thanks,
Laurent
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [RFC 2/6] linux-user: refactor socket.h for alpha
2017-09-22 14:02 ` [Qemu-devel] [RFC 2/6] linux-user: refactor socket.h for alpha Carlo Marcelo Arenas Belón
@ 2017-09-22 16:30 ` Laurent Vivier
0 siblings, 0 replies; 16+ messages in thread
From: Laurent Vivier @ 2017-09-22 16:30 UTC (permalink / raw)
To: Carlo Marcelo Arenas Belón, qemu-devel; +Cc: rth, riku.voipio
Le 22/09/2017 à 16:02, Carlo Marcelo Arenas Belón a écrit :
> based on fresh bits from linux 4.14 and therefore enabling SO_REUSEPORT
> as a side effect
>
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> ---
> 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
>
> diff --git a/linux-user/alpha/sockbits.h b/linux-user/alpha/sockbits.h
> new file mode 100644
> index 0000000000..768579a1f7
> --- /dev/null
> +++ b/linux-user/alpha/sockbits.h
> @@ -0,0 +1,104 @@
...
> +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.
...
> - 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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [RFC 3/6] linux-user: refactor socket.h for mips
2017-09-22 14:02 ` [Qemu-devel] [RFC 3/6] linux-user: refactor socket.h for mips Carlo Marcelo Arenas Belón
@ 2017-09-22 16:41 ` Laurent Vivier
0 siblings, 0 replies; 16+ messages in thread
From: Laurent Vivier @ 2017-09-22 16:41 UTC (permalink / raw)
To: Carlo Marcelo Arenas Belón, qemu-devel; +Cc: rth, riku.voipio
Le 22/09/2017 à 16:02, Carlo Marcelo Arenas Belón a écrit :
> fresh bits from linux 4.14, redefine SO_STYLE and {SO,SCM}_TIMESTAMP to
> the target values and enables SO_REUSEPORT
And you fix TARGET_SOCK_NONBLOCK value.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [RFC 4/6] linux-user: refactor socket.h for sparc
2017-09-22 14:02 ` [Qemu-devel] [RFC 4/6] linux-user: refactor socket.h for sparc Carlo Marcelo Arenas Belón
@ 2017-09-22 16:51 ` Laurent Vivier
0 siblings, 0 replies; 16+ messages in thread
From: Laurent Vivier @ 2017-09-22 16:51 UTC (permalink / raw)
To: Carlo Marcelo Arenas Belón, qemu-devel; +Cc: rth, riku.voipio
Le 22/09/2017 à 16:02, Carlo Marcelo Arenas Belón a écrit :
> fixes SOL_SOCKET and SO_LINGER at least
And fix TARGET_SOCK_NONBLOCK and TARGET_SOCK_CLOEXEC values.
>
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> ---
> 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
>
> diff --git a/linux-user/socket.h b/linux-user/socket.h
> index 036270a6e4..dfa692286b 100644
> --- a/linux-user/socket.h
> +++ b/linux-user/socket.h
> @@ -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,
> - };
...
> +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 = 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
>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [RFC 5/6] linux-user: fix 64bit versions of sparc and mips
2017-09-22 14:02 ` [Qemu-devel] [RFC 5/6] linux-user: fix 64bit versions of sparc and mips Carlo Marcelo Arenas Belón
@ 2017-09-22 17:01 ` Laurent Vivier
2017-09-25 11:44 ` Carlo Arenas
0 siblings, 1 reply; 16+ messages in thread
From: Laurent Vivier @ 2017-09-22 17:01 UTC (permalink / raw)
To: Carlo Marcelo Arenas Belón, qemu-devel; +Cc: rth, riku.voipio
Le 22/09/2017 à 16:02, Carlo Marcelo Arenas Belón a écrit :
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> ---
> 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
> 3 files changed, 4 insertions(+), 2 deletions(-)
> create mode 100644 linux-user/mips64/sockbits.h
> create mode 100644 linux-user/sparc64/sockbits.h
>
> diff --git a/linux-user/mips64/sockbits.h b/linux-user/mips64/sockbits.h
> new file mode 100644
> index 0000000000..e6b6d31ac9
> --- /dev/null
> +++ b/linux-user/mips64/sockbits.h
> @@ -0,0 +1 @@
> +#include "../mips/sockbits.h"
> diff --git a/linux-user/socket.h b/linux-user/socket.h
> index dfa692286b..6fd486c6b1 100644
> --- a/linux-user/socket.h
> +++ b/linux-user/socket.h
> @@ -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
>
> diff --git a/linux-user/sparc64/sockbits.h b/linux-user/sparc64/sockbits.h
> new file mode 100644
> index 0000000000..658899e4d3
> --- /dev/null
> +++ b/linux-user/sparc64/sockbits.h
> @@ -0,0 +1 @@
> +#include "../sparc/sockbits.h"
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [RFC 6/6] linux-user: update default socket.h
2017-09-22 14:02 ` [Qemu-devel] [RFC 6/6] linux-user: update default socket.h Carlo Marcelo Arenas Belón
@ 2017-09-22 17:04 ` Laurent Vivier
2017-09-25 11:55 ` Carlo Arenas
0 siblings, 1 reply; 16+ messages in thread
From: Laurent Vivier @ 2017-09-22 17:04 UTC (permalink / raw)
To: Carlo Marcelo Arenas Belón, qemu-devel; +Cc: rth, riku.voipio
Le 22/09/2017 à 16:02, Carlo Marcelo Arenas Belón a écrit :
> * enable SO_REUSEPORT as a sideeffect and add SO_GET_FILTER alias
> * 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
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> ---
> linux-user/socket.h | 61 ++++++++++++++++++++++++++++++++++++++++++-----------
> 1 file changed, 49 insertions(+), 12 deletions(-)
>
> diff --git a/linux-user/socket.h b/linux-user/socket.h
> index 6fd486c6b1..c37c10822a 100644
> --- a/linux-user/socket.h
> +++ b/linux-user/socket.h
> @@ -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
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [RFC 5/6] linux-user: fix 64bit versions of sparc and mips
2017-09-22 17:01 ` Laurent Vivier
@ 2017-09-25 11:44 ` Carlo Arenas
0 siblings, 0 replies; 16+ messages in thread
From: Carlo Arenas @ 2017-09-25 11:44 UTC (permalink / raw)
To: Laurent Vivier; +Cc: qemu-devel, rth, riku.voipio
On Fri, Sep 22, 2017 at 10:01 AM, Laurent Vivier <laurent@vivier.eu> wrote:
> Le 22/09/2017 à 16:02, Carlo Marcelo Arenas Belón a écrit :
> > Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> > ---
> > 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.
> 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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [RFC 6/6] linux-user: update default socket.h
2017-09-22 17:04 ` Laurent Vivier
@ 2017-09-25 11:55 ` Carlo Arenas
0 siblings, 0 replies; 16+ messages in thread
From: Carlo Arenas @ 2017-09-25 11:55 UTC (permalink / raw)
To: Laurent Vivier; +Cc: qemu-devel, rth, riku.voipio
On Fri, Sep 22, 2017 at 10:04 AM, Laurent Vivier <laurent@vivier.eu> wrote:
> 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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [RFC 1/6] linux-user: update hppa sockbits
2017-09-22 16:13 ` Laurent Vivier
@ 2017-09-25 12:40 ` Carlo Arenas
0 siblings, 0 replies; 16+ messages in thread
From: Carlo Arenas @ 2017-09-25 12:40 UTC (permalink / raw)
To: Laurent Vivier; +Cc: qemu-devel, rth, riku.voipio
On Fri, Sep 22, 2017 at 9:13 AM, Laurent Vivier <laurent@vivier.eu> wrote:
> Le 22/09/2017 à 16:02, Carlo Marcelo Arenas Belón a écrit :
> > updated to match arch/parisc/include/uapi/asm/socket.h from linux 4.14
>
> I 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?
> /** sock_type - Socket types - default values
> > *
> > - *
>
> 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
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2017-09-25 12:40 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-22 14:02 [Qemu-devel] [RFC 0/6] linux-user: refactor socket.h into architecture specific sockbits Carlo Marcelo Arenas Belón
2017-09-22 14:02 ` [Qemu-devel] [RFC 1/6] linux-user: update hppa sockbits Carlo Marcelo Arenas Belón
2017-09-22 16:13 ` Laurent Vivier
2017-09-25 12:40 ` Carlo Arenas
2017-09-22 14:02 ` [Qemu-devel] [RFC 2/6] linux-user: refactor socket.h for alpha Carlo Marcelo Arenas Belón
2017-09-22 16:30 ` Laurent Vivier
2017-09-22 14:02 ` [Qemu-devel] [RFC 3/6] linux-user: refactor socket.h for mips Carlo Marcelo Arenas Belón
2017-09-22 16:41 ` Laurent Vivier
2017-09-22 14:02 ` [Qemu-devel] [RFC 4/6] linux-user: refactor socket.h for sparc Carlo Marcelo Arenas Belón
2017-09-22 16:51 ` Laurent Vivier
2017-09-22 14:02 ` [Qemu-devel] [RFC 5/6] linux-user: fix 64bit versions of sparc and mips Carlo Marcelo Arenas Belón
2017-09-22 17:01 ` Laurent Vivier
2017-09-25 11:44 ` Carlo Arenas
2017-09-22 14:02 ` [Qemu-devel] [RFC 6/6] linux-user: update default socket.h Carlo Marcelo Arenas Belón
2017-09-22 17:04 ` Laurent Vivier
2017-09-25 11:55 ` Carlo Arenas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).