Commit 8f553bf7 authored by Laurent Vivier's avatar Laurent Vivier
Browse files

linux-user: update ARCH_HAS_SOCKET_TYPES use



to be like in the kernel and rename it TARGET_ARCH_HAS_SOCKET_TYPES

Signed-off-by: default avatarLaurent Vivier <laurent@vivier.eu>
Reviewed-by: default avatarPeter Maydell <peter.maydell@linaro.org>
Message-Id: <20180519092956.15134-7-laurent@vivier.eu>
parent 9e979d64
Loading
Loading
Loading
Loading
+3 −33
Original line number Diff line number Diff line
@@ -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
+3 −30
Original line number Diff line number Diff line
@@ -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
+6 −3
Original line number Diff line number Diff line
@@ -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
+32 −30
Original line number Diff line number Diff line

#include "sockbits.h"

#ifndef ARCH_HAS_SOCKET_TYPES
#ifndef TARGET_ARCH_HAS_SOCKET_TYPES
/** sock_type - Socket types - default values
 *
 *
@@ -25,11 +24,14 @@
       TARGET_SOCK_SEQPACKET   = 5,
       TARGET_SOCK_DCCP        = 6,
       TARGET_SOCK_PACKET      = 10,
           TARGET_SOCK_CLOEXEC     = 02000000,
           TARGET_SOCK_NONBLOCK    = 04000,
};

#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 */
+0 −36
Original line number Diff line number Diff line
@@ -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) */