Skip to content

Commit 5de33b1

Browse files
committed
linux-user: move mips socket.h definitions to mips/sockbits.h
No code change. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180519092956.15134-2-laurent@vivier.eu>
1 parent 309786c commit 5de33b1

File tree

3 files changed

+113
-104
lines changed

3 files changed

+113
-104
lines changed

linux-user/mips/sockbits.h

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
/*
2+
* This program is free software; you can redistribute it and/or modify
3+
* it under the terms of the GNU General Public License version 2 as
4+
* published by the Free Software Foundation, or (at your option) any
5+
* later version. See the COPYING file in the top-level directory.
6+
*/
7+
8+
#ifndef MIPS_SOCKBITS_H
9+
#define MIPS_SOCKBITS_H
10+
/* MIPS special values for constants */
11+
12+
/*
13+
* For setsockopt(2)
14+
*
15+
* This defines are ABI conformant as far as Linux supports these ...
16+
*/
17+
#define TARGET_SOL_SOCKET 0xffff
18+
19+
#define TARGET_SO_DEBUG 0x0001 /* Record debugging information. */
20+
#define TARGET_SO_REUSEADDR 0x0004 /* Allow reuse of local addresses. */
21+
#define TARGET_SO_KEEPALIVE 0x0008 /* Keep connections alive and send
22+
SIGPIPE when they die. */
23+
#define TARGET_SO_DONTROUTE 0x0010 /* Don't do local routing. */
24+
#define TARGET_SO_BROADCAST 0x0020 /* Allow transmission of
25+
broadcast messages. */
26+
#define TARGET_SO_LINGER 0x0080 /* Block on close of a reliable
27+
* socket to transmit pending data.
28+
*/
29+
#define TARGET_SO_OOBINLINE 0x0100 /* Receive out-of-band data in-band.
30+
*/
31+
#if 0
32+
/* To add: Allow local address and port reuse. */
33+
#define TARGET_SO_REUSEPORT 0x0200
34+
#endif
35+
36+
#define TARGET_SO_TYPE 0x1008 /* Compatible name for SO_STYLE. */
37+
#define TARGET_SO_STYLE SO_TYPE /* Synonym */
38+
#define TARGET_SO_ERROR 0x1007 /* get error status and clear */
39+
#define TARGET_SO_SNDBUF 0x1001 /* Send buffer size. */
40+
#define TARGET_SO_RCVBUF 0x1002 /* Receive buffer. */
41+
#define TARGET_SO_SNDLOWAT 0x1003 /* send low-water mark */
42+
#define TARGET_SO_RCVLOWAT 0x1004 /* receive low-water mark */
43+
#define TARGET_SO_SNDTIMEO 0x1005 /* send timeout */
44+
#define TARGET_SO_RCVTIMEO 0x1006 /* receive timeout */
45+
#define TARGET_SO_ACCEPTCONN 0x1009
46+
47+
/* linux-specific, might as well be the same as on i386 */
48+
#define TARGET_SO_NO_CHECK 11
49+
#define TARGET_SO_PRIORITY 12
50+
#define TARGET_SO_BSDCOMPAT 14
51+
52+
#define TARGET_SO_PASSCRED 17
53+
#define TARGET_SO_PEERCRED 18
54+
55+
/* Security levels - as per NRL IPv6 - don't actually do anything */
56+
#define TARGET_SO_SECURITY_AUTHENTICATION 22
57+
#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 23
58+
#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 24
59+
60+
#define TARGET_SO_BINDTODEVICE 25
61+
62+
/* Socket filtering */
63+
#define TARGET_SO_ATTACH_FILTER 26
64+
#define TARGET_SO_DETACH_FILTER 27
65+
66+
#define TARGET_SO_PEERNAME 28
67+
#define TARGET_SO_TIMESTAMP 29
68+
#define SCM_TIMESTAMP SO_TIMESTAMP
69+
70+
#define TARGET_SO_PEERSEC 30
71+
#define TARGET_SO_SNDBUFFORCE 31
72+
#define TARGET_SO_RCVBUFFORCE 33
73+
#define TARGET_SO_PASSSEC 34
74+
75+
/** sock_type - Socket types
76+
*
77+
* Please notice that for binary compat reasons MIPS has to
78+
* override the enum sock_type in include/linux/net.h, so
79+
* we define ARCH_HAS_SOCKET_TYPES here.
80+
*
81+
* @SOCK_DGRAM - datagram (conn.less) socket
82+
* @SOCK_STREAM - stream (connection) socket
83+
* @SOCK_RAW - raw socket
84+
* @SOCK_RDM - reliably-delivered message
85+
* @SOCK_SEQPACKET - sequential packet socket
86+
* @SOCK_DCCP - Datagram Congestion Control Protocol socket
87+
* @SOCK_PACKET - linux specific way of getting packets at the dev level.
88+
* For writing rarp and other similar things on the user
89+
* level.
90+
* @SOCK_CLOEXEC - sets the close-on-exec (FD_CLOEXEC) flag.
91+
* @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag.
92+
*/
93+
94+
#define ARCH_HAS_SOCKET_TYPES 1
95+
96+
enum sock_type {
97+
TARGET_SOCK_DGRAM = 1,
98+
TARGET_SOCK_STREAM = 2,
99+
TARGET_SOCK_RAW = 3,
100+
TARGET_SOCK_RDM = 4,
101+
TARGET_SOCK_SEQPACKET = 5,
102+
TARGET_SOCK_DCCP = 6,
103+
TARGET_SOCK_PACKET = 10,
104+
TARGET_SOCK_CLOEXEC = 02000000,
105+
TARGET_SOCK_NONBLOCK = 0200,
106+
};
107+
108+
#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
109+
#define TARGET_SOCK_TYPE_MASK 0xf /* Covers up to TARGET_SOCK_MAX-1. */
110+
#endif

linux-user/mips64/sockbits.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "../mips/sockbits.h"

linux-user/socket.h

Lines changed: 2 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,6 @@
11

2-
#if defined(TARGET_MIPS)
3-
/* MIPS special values for constants */
4-
5-
/*
6-
* For setsockopt(2)
7-
*
8-
* This defines are ABI conformant as far as Linux supports these ...
9-
*/
10-
#define TARGET_SOL_SOCKET 0xffff
11-
12-
#define TARGET_SO_DEBUG 0x0001 /* Record debugging information. */
13-
#define TARGET_SO_REUSEADDR 0x0004 /* Allow reuse of local addresses. */
14-
#define TARGET_SO_KEEPALIVE 0x0008 /* Keep connections alive and send
15-
SIGPIPE when they die. */
16-
#define TARGET_SO_DONTROUTE 0x0010 /* Don't do local routing. */
17-
#define TARGET_SO_BROADCAST 0x0020 /* Allow transmission of
18-
broadcast messages. */
19-
#define TARGET_SO_LINGER 0x0080 /* Block on close of a reliable
20-
* socket to transmit pending data.
21-
*/
22-
#define TARGET_SO_OOBINLINE 0x0100 /* Receive out-of-band data in-band.
23-
*/
24-
#if 0
25-
/* To add: Allow local address and port reuse. */
26-
#define TARGET_SO_REUSEPORT 0x0200
27-
#endif
28-
29-
#define TARGET_SO_TYPE 0x1008 /* Compatible name for SO_STYLE. */
30-
#define TARGET_SO_STYLE SO_TYPE /* Synonym */
31-
#define TARGET_SO_ERROR 0x1007 /* get error status and clear */
32-
#define TARGET_SO_SNDBUF 0x1001 /* Send buffer size. */
33-
#define TARGET_SO_RCVBUF 0x1002 /* Receive buffer. */
34-
#define TARGET_SO_SNDLOWAT 0x1003 /* send low-water mark */
35-
#define TARGET_SO_RCVLOWAT 0x1004 /* receive low-water mark */
36-
#define TARGET_SO_SNDTIMEO 0x1005 /* send timeout */
37-
#define TARGET_SO_RCVTIMEO 0x1006 /* receive timeout */
38-
#define TARGET_SO_ACCEPTCONN 0x1009
39-
40-
/* linux-specific, might as well be the same as on i386 */
41-
#define TARGET_SO_NO_CHECK 11
42-
#define TARGET_SO_PRIORITY 12
43-
#define TARGET_SO_BSDCOMPAT 14
44-
45-
#define TARGET_SO_PASSCRED 17
46-
#define TARGET_SO_PEERCRED 18
47-
48-
/* Security levels - as per NRL IPv6 - don't actually do anything */
49-
#define TARGET_SO_SECURITY_AUTHENTICATION 22
50-
#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 23
51-
#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 24
52-
53-
#define TARGET_SO_BINDTODEVICE 25
54-
55-
/* Socket filtering */
56-
#define TARGET_SO_ATTACH_FILTER 26
57-
#define TARGET_SO_DETACH_FILTER 27
58-
59-
#define TARGET_SO_PEERNAME 28
60-
#define TARGET_SO_TIMESTAMP 29
61-
#define SCM_TIMESTAMP SO_TIMESTAMP
62-
63-
#define TARGET_SO_PEERSEC 30
64-
#define TARGET_SO_SNDBUFFORCE 31
65-
#define TARGET_SO_RCVBUFFORCE 33
66-
#define TARGET_SO_PASSSEC 34
67-
68-
/** sock_type - Socket types
69-
*
70-
* Please notice that for binary compat reasons MIPS has to
71-
* override the enum sock_type in include/linux/net.h, so
72-
* we define ARCH_HAS_SOCKET_TYPES here.
73-
*
74-
* @SOCK_DGRAM - datagram (conn.less) socket
75-
* @SOCK_STREAM - stream (connection) socket
76-
* @SOCK_RAW - raw socket
77-
* @SOCK_RDM - reliably-delivered message
78-
* @SOCK_SEQPACKET - sequential packet socket
79-
* @SOCK_DCCP - Datagram Congestion Control Protocol socket
80-
* @SOCK_PACKET - linux specific way of getting packets at the dev level.
81-
* For writing rarp and other similar things on the user
82-
* level.
83-
* @SOCK_CLOEXEC - sets the close-on-exec (FD_CLOEXEC) flag.
84-
* @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag.
85-
*/
86-
87-
#define ARCH_HAS_SOCKET_TYPES 1
88-
89-
enum sock_type {
90-
TARGET_SOCK_DGRAM = 1,
91-
TARGET_SOCK_STREAM = 2,
92-
TARGET_SOCK_RAW = 3,
93-
TARGET_SOCK_RDM = 4,
94-
TARGET_SOCK_SEQPACKET = 5,
95-
TARGET_SOCK_DCCP = 6,
96-
TARGET_SOCK_PACKET = 10,
97-
TARGET_SOCK_CLOEXEC = 02000000,
98-
TARGET_SOCK_NONBLOCK = 0200,
99-
};
100-
101-
#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
102-
#define TARGET_SOCK_TYPE_MASK 0xf /* Covers up to TARGET_SOCK_MAX-1. */
103-
2+
#if defined(TARGET_MIPS) || defined(TARGET_HPPA)
3+
#include "sockbits.h"
1044
#elif defined(TARGET_ALPHA)
1055

1066
/* For setsockopt(2) */
@@ -205,8 +105,6 @@
205105

206106
#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
207107
#define TARGET_SOCK_TYPE_MASK 0xf /* Covers up to TARGET_SOCK_MAX-1. */
208-
#elif defined(TARGET_HPPA)
209-
#include <hppa/sockbits.h>
210108
#else
211109

212110
#if defined(TARGET_SPARC)

0 commit comments

Comments
 (0)