From nobody Tue Feb 10 12:13:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1527236445778862.471558158107; Fri, 25 May 2018 01:20:45 -0700 (PDT) Received: from localhost ([::1]:42384 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fM7xo-00035P-AX for importer@patchew.org; Fri, 25 May 2018 04:20:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38493) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fM7vf-0001mg-1u for qemu-devel@nongnu.org; Fri, 25 May 2018 04:18:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fM7va-0008IE-87 for qemu-devel@nongnu.org; Fri, 25 May 2018 04:18:26 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:37651) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fM7vZ-0008Fw-UG for qemu-devel@nongnu.org; Fri, 25 May 2018 04:18:22 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.183]) with ESMTPSA (Nemesis) id 0LrKBQ-1gMee92bxU-0136n3; Fri, 25 May 2018 10:18:13 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Fri, 25 May 2018 10:17:51 +0200 Message-Id: <20180525081754.29506-11-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180525081754.29506-1-laurent@vivier.eu> References: <20180525081754.29506-1-laurent@vivier.eu> X-Provags-ID: V03:K1:WHxRIOJ4SPJXt61GqK88bv/87wEOBjNMOYW85I/KDK4TWQlv8GS e2ISz7iNCYLpzfneEPuORv4VzxN6FoNpv6uvZS0pceDN+lhZAgqVkUTIuxuyAH5x1m85Y0u yFkne+HW5HSH8J4006xDrK5xTZVqdZL179/GqE0RbAmJftsufh3QZq34xVWraQuadsjZimX m61Gm+xiZtTj7OAtr7T7Q== X-UI-Out-Filterresults: notjunk:1;V01:K0:19XrSAb5FiI=:CAMgQHi4/0EeQTDjEE+LWT o372CcicTnSMK+se4Ribh5XxHUY75ljFYZw6U/gZuqVBvnnzWKyGBhB+f3z8Lh2VBgY/q7CAk Fn6Nyr/ItAXaI5eDzoxeqyN1raZL87sKMN8kOsbALJc09i1IupFyxelupwONF9AWitWhtXccn Rsm6e7FU4CIx7/mAKgMrYl6t1A3liA6AjILDSpsKG4WNuDnAQdbWesnMo8IqZn5fn4gs/zIfk i5Xq9csXcPFgnFhphyx/QWDqzdxv3wQFwl4i8+awP7RCN2ZQ65aZEmhKGAMV/3DkxHprJ51EU Twnu+3YUbHfvcqbGfnrPqEU5k4LSiD9ctK1XagGVcVkQsz/emUgZ8PR91QJVY0ypbBvlIAlJt FARE0TrLhOQ9gni+l7L+gqXHRQmm1erdtsm5oitFI67pVpeaFWwsE6xzhGpJsi6UzeQ6QFAIf kaOIuxX7B3vBhx+NhhS1aoiYfXuexZTIC+6EUCgpkinDyUq/A0iMaGeGlFeut3JfiukduvVc5 zBR2E0v5ycrEEw18ZLXY/GD4I8f0j/96vwSH49rGJfnUF1e2j3SWM28c9AqIjElWTPYSQ8ten rVPJsLd62iQkb4HFLjNaCPDrzQkahS8SjtvQeG89TQTdH99qnPatq095E8reGBybix+jY/V28 UoF2dZssJETT+tESPbhVn0bdk0C4JcApMCHm1xpiMFQ8rBmsWFadxk9yrngzAOVQSb70= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.10 Subject: [Qemu-devel] [PULL 10/13] linux-user: update ARCH_HAS_SOCKET_TYPES use X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" to be like in the kernel and rename it TARGET_ARCH_HAS_SOCKET_TYPES Signed-off-by: Laurent Vivier Reviewed-by: Peter Maydell Message-Id: <20180519092956.15134-7-laurent@vivier.eu> --- linux-user/alpha/sockbits.h | 36 +++----------------------- linux-user/hppa/sockbits.h | 33 +++--------------------- linux-user/mips/sockbits.h | 9 ++++--- linux-user/socket.h | 62 +++++++++++++++++++++++------------------= ---- linux-user/sparc/sockbits.h | 36 -------------------------- 5 files changed, 44 insertions(+), 132 deletions(-) diff --git a/linux-user/alpha/sockbits.h b/linux-user/alpha/sockbits.h index 4db3e52b67..f5397dd875 100644 --- a/linux-user/alpha/sockbits.h +++ b/linux-user/alpha/sockbits.h @@ -75,39 +75,9 @@ /* Instruct lower device to use last 4-bytes of skb data as FCS */ #define TARGET_SO_NOFCS 43 =20 -/** sock_type - Socket types - * - * Please notice that for binary compat reasons ALPHA has to - * override the enum sock_type in include/linux/net.h, so - * we define ARCH_HAS_SOCKET_TYPES here. - * - * @SOCK_DGRAM - datagram (conn.less) socket - * @SOCK_STREAM - stream (connection) socket - * @SOCK_RAW - raw socket - * @SOCK_RDM - reliably-delivered message - * @SOCK_SEQPACKET - sequential packet socket - * @SOCK_DCCP - Datagram Congestion Control Protocol socket - * @SOCK_PACKET - linux specific way of getting packets at the dev level. - * For writing rarp and other similar things on the user - * level. - * @SOCK_CLOEXEC - sets the close-on-exec (FD_CLOEXEC) flag. - * @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag. +/* TARGET_O_NONBLOCK clashes with the bits used for socket types. Therefo= re we + * have to define SOCK_NONBLOCK to a different value here. */ +#define TARGET_SOCK_NONBLOCK 0x40000000 =20 -#define ARCH_HAS_SOCKET_TYPES 1 - -enum sock_type { - TARGET_SOCK_STREAM =3D 1, - TARGET_SOCK_DGRAM =3D 2, - TARGET_SOCK_RAW =3D 3, - TARGET_SOCK_RDM =3D 4, - TARGET_SOCK_SEQPACKET =3D 5, - TARGET_SOCK_DCCP =3D 6, - TARGET_SOCK_PACKET =3D 10, - TARGET_SOCK_CLOEXEC =3D 010000000, - TARGET_SOCK_NONBLOCK =3D 010000000000, -}; - -#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1) -#define TARGET_SOCK_TYPE_MASK 0xf /* Covers up to TARGET_SOCK_MAX-1. */ #endif diff --git a/linux-user/hppa/sockbits.h b/linux-user/hppa/sockbits.h index 5044619e16..2641aea859 100644 --- a/linux-user/hppa/sockbits.h +++ b/linux-user/hppa/sockbits.h @@ -64,34 +64,7 @@ =20 #define TARGET_SO_CNX_ADVICE 0x402E =20 -/** sock_type - Socket types - default values - * - * - * @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. +/* TARGET_O_NONBLOCK clashes with the bits used for socket types. Therefo= re we + * have to define SOCK_NONBLOCK to a different value here. */ -enum sock_type { - TARGET_SOCK_STREAM =3D 1, - TARGET_SOCK_DGRAM =3D 2, - TARGET_SOCK_RAW =3D 3, - TARGET_SOCK_RDM =3D 4, - TARGET_SOCK_SEQPACKET =3D 5, - TARGET_SOCK_DCCP =3D 6, - TARGET_SOCK_PACKET =3D 10, - TARGET_SOCK_CLOEXEC =3D 010000000, - TARGET_SOCK_NONBLOCK =3D 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 +#define TARGET_SOCK_NONBLOCK 0x40000000 diff --git a/linux-user/mips/sockbits.h b/linux-user/mips/sockbits.h index 3fe5ac88e7..370d13ed86 100644 --- a/linux-user/mips/sockbits.h +++ b/linux-user/mips/sockbits.h @@ -91,7 +91,7 @@ * @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag. */ =20 -#define ARCH_HAS_SOCKET_TYPES 1 +#define TARGET_ARCH_HAS_SOCKET_TYPES 1 =20 enum sock_type { TARGET_SOCK_DGRAM =3D 1, @@ -101,10 +101,13 @@ enum sock_type { TARGET_SOCK_SEQPACKET =3D 5, TARGET_SOCK_DCCP =3D 6, TARGET_SOCK_PACKET =3D 10, - TARGET_SOCK_CLOEXEC =3D 02000000, - TARGET_SOCK_NONBLOCK =3D 0200, }; =20 #define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1) #define TARGET_SOCK_TYPE_MASK 0xf /* Covers up to TARGET_SOCK_MAX-1. */ + +/* Flags for socket, socketpair, paccept */ +#define TARGET_SOCK_CLOEXEC TARGET_O_CLOEXEC +#define TARGET_SOCK_NONBLOCK TARGET_O_NONBLOCK + #endif diff --git a/linux-user/socket.h b/linux-user/socket.h index 135f438bdf..4c0b5c2dfa 100644 --- a/linux-user/socket.h +++ b/linux-user/socket.h @@ -1,35 +1,37 @@ - #include "sockbits.h" =20 -#ifndef ARCH_HAS_SOCKET_TYPES - /** sock_type - Socket types - default values - * - * - * @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 lev= el. - * 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 =3D 1, - TARGET_SOCK_DGRAM =3D 2, - TARGET_SOCK_RAW =3D 3, - TARGET_SOCK_RDM =3D 4, - TARGET_SOCK_SEQPACKET =3D 5, - TARGET_SOCK_DCCP =3D 6, - TARGET_SOCK_PACKET =3D 10, - TARGET_SOCK_CLOEXEC =3D 02000000, - TARGET_SOCK_NONBLOCK =3D 04000, - }; +#ifndef TARGET_ARCH_HAS_SOCKET_TYPES +/** sock_type - Socket types - default values + * + * + * @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 =3D 1, + TARGET_SOCK_DGRAM =3D 2, + TARGET_SOCK_RAW =3D 3, + TARGET_SOCK_RDM =3D 4, + TARGET_SOCK_SEQPACKET =3D 5, + TARGET_SOCK_DCCP =3D 6, + TARGET_SOCK_PACKET =3D 10, +}; =20 - #define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1) - #define TARGET_SOCK_TYPE_MASK 0xf /* Covers up to TARGET_SOCK_MAX-= 1. */ +#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1) +#define TARGET_SOCK_TYPE_MASK 0xf /* Covers up to TARGET_SOCK_MAX-1. */ =20 +/* Flags for socket, socketpair, accept4 */ +#define TARGET_SOCK_CLOEXEC TARGET_O_CLOEXEC +#ifndef TARGET_SOCK_NONBLOCK +#define TARGET_SOCK_NONBLOCK TARGET_O_NONBLOCK #endif +#endif /* TARGET_ARCH_HAS_SOCKET_TYPES */ diff --git a/linux-user/sparc/sockbits.h b/linux-user/sparc/sockbits.h index 385061c8b0..6434b07033 100644 --- a/linux-user/sparc/sockbits.h +++ b/linux-user/sparc/sockbits.h @@ -8,42 +8,6 @@ #ifndef SPARC_SOCKBITS_H #define SPARC_SOCKBITS_H =20 -/** 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 =3D 1, - TARGET_SOCK_DGRAM =3D 2, - TARGET_SOCK_RAW =3D 3, - TARGET_SOCK_RDM =3D 4, - TARGET_SOCK_SEQPACKET =3D 5, - TARGET_SOCK_DCCP =3D 6, - TARGET_SOCK_PACKET =3D 10, - TARGET_SOCK_CLOEXEC =3D 020000000, - TARGET_SOCK_NONBLOCK =3D 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 =20 /* For setsockopt(2) */ --=20 2.14.3