diff options
Diffstat (limited to 'include/linux/net.h')
-rw-r--r-- | include/linux/net.h | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/include/linux/net.h b/include/linux/net.h index 71f7dd559285..4a9a30f2d68f 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include <linux/wait.h> | 21 | #include <linux/wait.h> |
22 | #include <linux/socket.h> | 22 | #include <linux/socket.h> |
23 | #include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */ | ||
23 | #include <asm/socket.h> | 24 | #include <asm/socket.h> |
24 | 25 | ||
25 | struct poll_table_struct; | 26 | struct poll_table_struct; |
@@ -46,6 +47,7 @@ struct net; | |||
46 | #define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */ | 47 | #define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */ |
47 | #define SYS_SENDMSG 16 /* sys_sendmsg(2) */ | 48 | #define SYS_SENDMSG 16 /* sys_sendmsg(2) */ |
48 | #define SYS_RECVMSG 17 /* sys_recvmsg(2) */ | 49 | #define SYS_RECVMSG 17 /* sys_recvmsg(2) */ |
50 | #define SYS_PACCEPT 18 /* sys_paccept(2) */ | ||
49 | 51 | ||
50 | typedef enum { | 52 | typedef enum { |
51 | SS_FREE = 0, /* not allocated */ | 53 | SS_FREE = 0, /* not allocated */ |
@@ -94,6 +96,15 @@ enum sock_type { | |||
94 | }; | 96 | }; |
95 | 97 | ||
96 | #define SOCK_MAX (SOCK_PACKET + 1) | 98 | #define SOCK_MAX (SOCK_PACKET + 1) |
99 | /* Mask which covers at least up to SOCK_MASK-1. The | ||
100 | * remaining bits are used as flags. */ | ||
101 | #define SOCK_TYPE_MASK 0xf | ||
102 | |||
103 | /* Flags for socket, socketpair, paccept */ | ||
104 | #define SOCK_CLOEXEC O_CLOEXEC | ||
105 | #ifndef SOCK_NONBLOCK | ||
106 | #define SOCK_NONBLOCK O_NONBLOCK | ||
107 | #endif | ||
97 | 108 | ||
98 | #endif /* ARCH_HAS_SOCKET_TYPES */ | 109 | #endif /* ARCH_HAS_SOCKET_TYPES */ |
99 | 110 | ||
@@ -106,23 +117,23 @@ enum sock_shutdown_cmd { | |||
106 | /** | 117 | /** |
107 | * struct socket - general BSD socket | 118 | * struct socket - general BSD socket |
108 | * @state: socket state (%SS_CONNECTED, etc) | 119 | * @state: socket state (%SS_CONNECTED, etc) |
120 | * @type: socket type (%SOCK_STREAM, etc) | ||
109 | * @flags: socket flags (%SOCK_ASYNC_NOSPACE, etc) | 121 | * @flags: socket flags (%SOCK_ASYNC_NOSPACE, etc) |
110 | * @ops: protocol specific socket operations | 122 | * @ops: protocol specific socket operations |
111 | * @fasync_list: Asynchronous wake up list | 123 | * @fasync_list: Asynchronous wake up list |
112 | * @file: File back pointer for gc | 124 | * @file: File back pointer for gc |
113 | * @sk: internal networking protocol agnostic socket representation | 125 | * @sk: internal networking protocol agnostic socket representation |
114 | * @wait: wait queue for several uses | 126 | * @wait: wait queue for several uses |
115 | * @type: socket type (%SOCK_STREAM, etc) | ||
116 | */ | 127 | */ |
117 | struct socket { | 128 | struct socket { |
118 | socket_state state; | 129 | socket_state state; |
130 | short type; | ||
119 | unsigned long flags; | 131 | unsigned long flags; |
120 | const struct proto_ops *ops; | 132 | const struct proto_ops *ops; |
121 | struct fasync_struct *fasync_list; | 133 | struct fasync_struct *fasync_list; |
122 | struct file *file; | 134 | struct file *file; |
123 | struct sock *sk; | 135 | struct sock *sk; |
124 | wait_queue_head_t wait; | 136 | wait_queue_head_t wait; |
125 | short type; | ||
126 | }; | 137 | }; |
127 | 138 | ||
128 | struct vm_area_struct; | 139 | struct vm_area_struct; |
@@ -208,10 +219,12 @@ extern int sock_sendmsg(struct socket *sock, struct msghdr *msg, | |||
208 | size_t len); | 219 | size_t len); |
209 | extern int sock_recvmsg(struct socket *sock, struct msghdr *msg, | 220 | extern int sock_recvmsg(struct socket *sock, struct msghdr *msg, |
210 | size_t size, int flags); | 221 | size_t size, int flags); |
211 | extern int sock_map_fd(struct socket *sock); | 222 | extern int sock_map_fd(struct socket *sock, int flags); |
212 | extern struct socket *sockfd_lookup(int fd, int *err); | 223 | extern struct socket *sockfd_lookup(int fd, int *err); |
213 | #define sockfd_put(sock) fput(sock->file) | 224 | #define sockfd_put(sock) fput(sock->file) |
214 | extern int net_ratelimit(void); | 225 | extern int net_ratelimit(void); |
226 | extern long do_accept(int fd, struct sockaddr __user *upeer_sockaddr, | ||
227 | int __user *upeer_addrlen, int flags); | ||
215 | 228 | ||
216 | #define net_random() random32() | 229 | #define net_random() random32() |
217 | #define net_srandom(seed) srandom32((__force u32)seed) | 230 | #define net_srandom(seed) srandom32((__force u32)seed) |
@@ -338,8 +351,7 @@ static const struct proto_ops name##_ops = { \ | |||
338 | 351 | ||
339 | #ifdef CONFIG_SYSCTL | 352 | #ifdef CONFIG_SYSCTL |
340 | #include <linux/sysctl.h> | 353 | #include <linux/sysctl.h> |
341 | extern int net_msg_cost; | 354 | extern struct ratelimit_state net_ratelimit_state; |
342 | extern int net_msg_burst; | ||
343 | #endif | 355 | #endif |
344 | 356 | ||
345 | #endif /* __KERNEL__ */ | 357 | #endif /* __KERNEL__ */ |