From patchwork Fri May 25 08:17:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 920292 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40sfL26tfyz9s1d for ; Fri, 25 May 2018 18:19:22 +1000 (AEST) Received: from localhost ([::1]:42379 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fM7wW-0001qq-Di for incoming@patchwork.ozlabs.org; Fri, 25 May 2018 04:19:20 -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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 -/** sock_type - Socket types - * - * Please notice that for binary compat reasons ALPHA has to - * override the enum sock_type in include/linux/net.h, so - * we define ARCH_HAS_SOCKET_TYPES here. - * - * @SOCK_DGRAM - datagram (conn.less) socket - * @SOCK_STREAM - stream (connection) socket - * @SOCK_RAW - raw socket - * @SOCK_RDM - reliably-delivered message - * @SOCK_SEQPACKET - sequential packet socket - * @SOCK_DCCP - Datagram Congestion Control Protocol socket - * @SOCK_PACKET - linux specific way of getting packets at the dev level. - * For writing rarp and other similar things on the user - * level. - * @SOCK_CLOEXEC - sets the close-on-exec (FD_CLOEXEC) flag. - * @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag. +/* TARGET_O_NONBLOCK clashes with the bits used for socket types. Therefore we + * have to define SOCK_NONBLOCK to a different value here. */ +#define TARGET_SOCK_NONBLOCK 0x40000000 -#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. */ #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 @@ #define TARGET_SO_CNX_ADVICE 0x402E -/** 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. Therefore we + * have to define SOCK_NONBLOCK to a different value here. */ -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 +#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. */ -#define ARCH_HAS_SOCKET_TYPES 1 +#define TARGET_ARCH_HAS_SOCKET_TYPES 1 enum sock_type { TARGET_SOCK_DGRAM = 1, @@ -101,10 +101,13 @@ enum sock_type { 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. */ + +/* 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" -#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 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 = 02000000, - TARGET_SOCK_NONBLOCK = 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 = 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, +}; - #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. */ +/* 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 -/** 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 /* For setsockopt(2) */