From patchwork Wed May 16 20:55:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 914940 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 40mRj24fPbz9s1d for ; Thu, 17 May 2018 07:02:46 +1000 (AEST) Received: from localhost ([::1]:40229 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ3ZM-0004f5-9Q for incoming@patchwork.ozlabs.org; Wed, 16 May 2018 17:02:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52679) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ3TZ-0000Jv-E6 for qemu-devel@nongnu.org; Wed, 16 May 2018 16:56:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJ3TW-00047w-AD for qemu-devel@nongnu.org; Wed, 16 May 2018 16:56:45 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:48089) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fJ3TV-00047Z-W0 for qemu-devel@nongnu.org; Wed, 16 May 2018 16:56:42 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.183]) with ESMTPSA (Nemesis) id 0MA5UH-1f8MDS2HrV-00BOuZ; Wed, 16 May 2018 22:56:04 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 16 May 2018 22:55:41 +0200 Message-Id: <20180516205543.29305-7-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180516205543.29305-1-laurent@vivier.eu> References: <20180516205543.29305-1-laurent@vivier.eu> X-Provags-ID: V03:K1:fygvOULWAatTRvkeplap5VpWdOamay44dtevlSmlZNEnGbrkEWv dforizEd3WPIDohCIScS4cNRpeVtZ/WZz+srbM+wned2lm39GZ8YatsYdmAFF8/Hodo/f+s Z+7uZsdvwMMdSQSzigf1t2pifPhz383Wm1aV72SNawjXbgyBFkdDtuEM4FGJrfDatGez4bn /0WrroyEOIYMsuHLCh/MQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:FewpPD8MMTg=:COlgHwpxlXCFfp2g9tryLS 70VEid+44soC3LVze69DXhYtCjV/1bZwsEBpaQBpePML37yYHU/u0TUnoIO867kvQHvE9rbhq 9AUhJG+xM4bNLclGo7fYdhhfpKHIrxOyFfBXWkbOH7NX5vOq1UgEPdDUSM0YzxOCMf9kbvzCx Tt02EcJ7fR7LCFKBmk42vXDjxRR5t13fNHpfWpP8FsQfYnNaZ0dqFx5D9zDcXaWw4gA+Akb0I UUXfbplDaxkLY9BV7r3GMUJJGEmVJyDR3pIXLRFWWpGaXvSa5hC/7ZUBc7Lh9AtYea/1YnU0g s8mD+con9JEKyQUUaAv5mnLLP39q3OiR3XV/iC8eDvx3XDtEEofKN3i+Nj6g77ndEbMU4zzAN 3rm4JWqAdMhaas6za5cpZ7/n5eQFLuZ+/Mb+YqTYjk5TUbJqnbszIxkvWUmlgtgMST6511aCM j55KDR5qyk8tnG66x5rLJTcEzaAZJpB+wM5TlI/rH96fHgc3pXiuCOAowWRunAGt+o3NjwgHH TvSnJQsOsiPAEC9NvT9O69p3FBd4d5xJKgNwN6WdsCCmmUT1W6TYKnJtCSk+WmiPk9TL+iYNV 1zkW1NeCUeyZZOV6+5wbuUmbWv+8BepUm69obb6URx761LLDW/z4IwR12TGQf8/s5BhhoXbyf OEceQ26tf88dvaXPuishg1Jpt3OZ2PwKTdAWXmcrmBHP1ZKAERAF5L3NNpOOqqhIvbVg= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.13 Subject: [Qemu-devel] [PATCH v2 6/8] 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: Peter Maydell , Riku Voipio , Mark Cave-Ayland , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= , Yongbok Kim , Richard Henderson 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 --- 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..8de8681015 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 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) */