Deleted Added
full compact
socketvar.h (95343) socketvar.h (95552)
1/*-
2 * Copyright (c) 1982, 1986, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)socketvar.h 8.3 (Berkeley) 2/19/95
1/*-
2 * Copyright (c) 1982, 1986, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)socketvar.h 8.3 (Berkeley) 2/19/95
34 * $FreeBSD: head/sys/sys/socketvar.h 95343 2002-04-24 04:11:08Z silby $
34 * $FreeBSD: head/sys/sys/socketvar.h 95552 2002-04-27 08:24:29Z tanimura $
35 */
36
37#ifndef _SYS_SOCKETVAR_H_
38#define _SYS_SOCKETVAR_H_
39
40#include <sys/queue.h> /* for TAILQ macros */
35 */
36
37#ifndef _SYS_SOCKETVAR_H_
38#define _SYS_SOCKETVAR_H_
39
40#include <sys/queue.h> /* for TAILQ macros */
41#include <sys/filedesc.h>
42#include <sys/lock.h>
43#include <sys/mutex.h>
44#include <sys/sx.h>
41#include <sys/selinfo.h> /* for struct selinfo */
42#include <vm/uma.h>
43
44/*
45 * Kernel structure per socket.
46 * Contains send and receive buffer queues,
47 * handle on protocol and pointer to protocol
48 * private data and error information.
49 */
50typedef u_quad_t so_gen_t;
51
52struct accept_filter;
53
45#include <sys/selinfo.h> /* for struct selinfo */
46#include <vm/uma.h>
47
48/*
49 * Kernel structure per socket.
50 * Contains send and receive buffer queues,
51 * handle on protocol and pointer to protocol
52 * private data and error information.
53 */
54typedef u_quad_t so_gen_t;
55
56struct accept_filter;
57
58/*
59 * List of locks:
60 * (c) const, inited in either socreate() or sonewconn()
61 * (m) sb_mtx mutex
62 * (mr) so_rcv.sb_mtx mutex
63 * (sg) sigio_lock sx
64 * (sh) sohead_lock sx
65 *
66 * Lock of so_rcv.sb_mtx can duplicate, provided that sohead_lock
67 * is exclusively locked.
68 *
69 * Brackets mean that this data is not protected yet.
70 */
54struct socket {
55 int so_count; /* reference count */
56 short so_type; /* generic type, see socket.h */
57 short so_options; /* from socket call, see socket.h */
58 short so_linger; /* time to linger while closing */
59 short so_state; /* internal state flags SS_*, below */
60 caddr_t so_pcb; /* protocol control block */
61 struct protosw *so_proto; /* protocol handle */

--- 13 unchanged lines hidden (view full) ---

75 TAILQ_HEAD(, socket) so_comp; /* queue of complete unaccepted connections */
76 TAILQ_ENTRY(socket) so_list; /* list of unaccepted connections */
77 short so_qlen; /* number of unaccepted connections */
78 short so_incqlen; /* number of unaccepted incomplete
79 connections */
80 short so_qlimit; /* max number queued connections */
81 short so_timeo; /* connection timeout */
82 u_short so_error; /* error affecting connection */
71struct socket {
72 int so_count; /* reference count */
73 short so_type; /* generic type, see socket.h */
74 short so_options; /* from socket call, see socket.h */
75 short so_linger; /* time to linger while closing */
76 short so_state; /* internal state flags SS_*, below */
77 caddr_t so_pcb; /* protocol control block */
78 struct protosw *so_proto; /* protocol handle */

--- 13 unchanged lines hidden (view full) ---

92 TAILQ_HEAD(, socket) so_comp; /* queue of complete unaccepted connections */
93 TAILQ_ENTRY(socket) so_list; /* list of unaccepted connections */
94 short so_qlen; /* number of unaccepted connections */
95 short so_incqlen; /* number of unaccepted incomplete
96 connections */
97 short so_qlimit; /* max number queued connections */
98 short so_timeo; /* connection timeout */
99 u_short so_error; /* error affecting connection */
83 struct sigio *so_sigio; /* information for async I/O or
100 struct sigio *so_sigio; /* [sg] information for async I/O or
84 out of band data (SIGURG) */
85 u_long so_oobmark; /* chars to oob mark */
86 TAILQ_HEAD(, aiocblist) so_aiojobq; /* AIO ops waiting on socket */
87/*
88 * Variables for socket buffering.
89 */
90 struct sockbuf {
91 u_long sb_cc; /* actual chars in buffer */

--- 170 unchanged lines hidden (view full) ---

262 sofree(so); \
263 } while (0)
264
265#define sotryfree(so) do { \
266 if ((so)->so_count == 0) \
267 sofree(so); \
268 } while(0)
269
101 out of band data (SIGURG) */
102 u_long so_oobmark; /* chars to oob mark */
103 TAILQ_HEAD(, aiocblist) so_aiojobq; /* AIO ops waiting on socket */
104/*
105 * Variables for socket buffering.
106 */
107 struct sockbuf {
108 u_long sb_cc; /* actual chars in buffer */

--- 170 unchanged lines hidden (view full) ---

279 sofree(so); \
280 } while (0)
281
282#define sotryfree(so) do { \
283 if ((so)->so_count == 0) \
284 sofree(so); \
285 } while(0)
286
270#define sorwakeup(so) do { \
271 if (sb_notify(&(so)->so_rcv)) \
272 sowakeup((so), &(so)->so_rcv); \
273 } while (0)
287#define sorwakeup_locked(so) do { \
288 SIGIO_ASSERT(SX_SLOCKED); /* XXX */ \
289 if (sb_notify(&(so)->so_rcv)) \
290 sowakeup((so), &(so)->so_rcv); \
291 } while (0)
274
292
275#define sowwakeup(so) do { \
276 if (sb_notify(&(so)->so_snd)) \
277 sowakeup((so), &(so)->so_snd); \
278 } while (0)
293#define sorwakeup(so) do { \
294 SIGIO_SLOCK(); \
295 sorwakeup_locked(so); \
296 SIGIO_SUNLOCK(); \
297 } while (0)
279
298
299#define sowwakeup_locked(so) do { \
300 SIGIO_ASSERT(SX_SLOCKED); /* XXX */ \
301 if (sb_notify(&(so)->so_snd)) \
302 sowakeup((so), &(so)->so_snd); \
303 } while (0)
304
305#define sowwakeup(so) do { \
306 SIGIO_SLOCK(); \
307 sowwakeup_locked(so); \
308 SIGIO_SUNLOCK(); \
309 } while (0)
310
280#ifdef _KERNEL
281
282/*
283 * Argument structure for sosetopt et seq. This is in the KERNEL
284 * section because it will never be visible to user code.
285 */
286enum sopt_dir { SOPT_GET, SOPT_SET };
287struct sockopt {

--- 94 unchanged lines hidden (view full) ---

382int soconnect2(struct socket *so1, struct socket *so2);
383int socreate(int dom, struct socket **aso, int type, int proto,
384 struct ucred *cred, struct thread *td);
385int sodisconnect(struct socket *so);
386void sofree(struct socket *so);
387int sogetopt(struct socket *so, struct sockopt *sopt);
388void sohasoutofband(struct socket *so);
389void soisconnected(struct socket *so);
311#ifdef _KERNEL
312
313/*
314 * Argument structure for sosetopt et seq. This is in the KERNEL
315 * section because it will never be visible to user code.
316 */
317enum sopt_dir { SOPT_GET, SOPT_SET };
318struct sockopt {

--- 94 unchanged lines hidden (view full) ---

413int soconnect2(struct socket *so1, struct socket *so2);
414int socreate(int dom, struct socket **aso, int type, int proto,
415 struct ucred *cred, struct thread *td);
416int sodisconnect(struct socket *so);
417void sofree(struct socket *so);
418int sogetopt(struct socket *so, struct sockopt *sopt);
419void sohasoutofband(struct socket *so);
420void soisconnected(struct socket *so);
421void soisconnected_locked(struct socket *so);
390void soisconnecting(struct socket *so);
391void soisdisconnected(struct socket *so);
422void soisconnecting(struct socket *so);
423void soisdisconnected(struct socket *so);
424void soisdisconnected_locked(struct socket *so);
392void soisdisconnecting(struct socket *so);
393int solisten(struct socket *so, int backlog, struct thread *td);
394struct socket *
395 sonewconn(struct socket *head, int connstatus);
396int sooptcopyin(struct sockopt *sopt, void *buf, size_t len, size_t minlen);
397int sooptcopyout(struct sockopt *sopt, void *buf, size_t len);
398
399/* XXX; prepare mbuf for (__FreeBSD__ < 3) routines. */

--- 33 unchanged lines hidden ---
425void soisdisconnecting(struct socket *so);
426int solisten(struct socket *so, int backlog, struct thread *td);
427struct socket *
428 sonewconn(struct socket *head, int connstatus);
429int sooptcopyin(struct sockopt *sopt, void *buf, size_t len, size_t minlen);
430int sooptcopyout(struct sockopt *sopt, void *buf, size_t len);
431
432/* XXX; prepare mbuf for (__FreeBSD__ < 3) routines. */

--- 33 unchanged lines hidden ---