Deleted Added
full compact
sockbuf.h (262914) sockbuf.h (262915)
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

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

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)socketvar.h 8.3 (Berkeley) 2/19/95
30 *
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

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

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)socketvar.h 8.3 (Berkeley) 2/19/95
30 *
31 * $FreeBSD: head/sys/sys/sockbuf.h 262914 2014-03-07 23:30:48Z asomers $
31 * $FreeBSD: head/sys/sys/sockbuf.h 262915 2014-03-07 23:40:36Z asomers $
32 */
33#ifndef _SYS_SOCKBUF_H_
34#define _SYS_SOCKBUF_H_
35#include <sys/selinfo.h> /* for struct selinfo */
36#include <sys/_lock.h>
37#include <sys/_mutex.h>
38#include <sys/_sx.h>
39

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

47#define SB_ASYNC 0x10 /* ASYNC I/O, need signals */
48#define SB_UPCALL 0x20 /* someone wants an upcall */
49#define SB_NOINTR 0x40 /* operations not interruptible */
50#define SB_AIO 0x80 /* AIO operations queued */
51#define SB_KNOTE 0x100 /* kernel note attached */
52#define SB_NOCOALESCE 0x200 /* don't coalesce new data into existing mbufs */
53#define SB_IN_TOE 0x400 /* socket buffer is in the middle of an operation */
54#define SB_AUTOSIZE 0x800 /* automatically size socket buffer */
32 */
33#ifndef _SYS_SOCKBUF_H_
34#define _SYS_SOCKBUF_H_
35#include <sys/selinfo.h> /* for struct selinfo */
36#include <sys/_lock.h>
37#include <sys/_mutex.h>
38#include <sys/_sx.h>
39

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

47#define SB_ASYNC 0x10 /* ASYNC I/O, need signals */
48#define SB_UPCALL 0x20 /* someone wants an upcall */
49#define SB_NOINTR 0x40 /* operations not interruptible */
50#define SB_AIO 0x80 /* AIO operations queued */
51#define SB_KNOTE 0x100 /* kernel note attached */
52#define SB_NOCOALESCE 0x200 /* don't coalesce new data into existing mbufs */
53#define SB_IN_TOE 0x400 /* socket buffer is in the middle of an operation */
54#define SB_AUTOSIZE 0x800 /* automatically size socket buffer */
55#define SB_STOP 0x1000 /* backpressure indicator */
56
57#define SBS_CANTSENDMORE 0x0010 /* can't send more data to peer */
58#define SBS_CANTRCVMORE 0x0020 /* can't receive more data from peer */
59#define SBS_RCVATMARK 0x0040 /* at mark on input */
60
61struct mbuf;
62struct sockaddr;
63struct socket;

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

164void sbunlock(struct sockbuf *sb);
165
166/*
167 * How much space is there in a socket buffer (so->so_snd or so->so_rcv)?
168 * This is problematical if the fields are unsigned, as the space might
169 * still be negative (cc > hiwat or mbcnt > mbmax). Should detect
170 * overflow and return 0. Should use "lmin" but it doesn't exist now.
171 */
55
56#define SBS_CANTSENDMORE 0x0010 /* can't send more data to peer */
57#define SBS_CANTRCVMORE 0x0020 /* can't receive more data from peer */
58#define SBS_RCVATMARK 0x0040 /* at mark on input */
59
60struct mbuf;
61struct sockaddr;
62struct socket;

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

163void sbunlock(struct sockbuf *sb);
164
165/*
166 * How much space is there in a socket buffer (so->so_snd or so->so_rcv)?
167 * This is problematical if the fields are unsigned, as the space might
168 * still be negative (cc > hiwat or mbcnt > mbmax). Should detect
169 * overflow and return 0. Should use "lmin" but it doesn't exist now.
170 */
172static __inline
173long
174sbspace(struct sockbuf *sb)
175{
176 long bleft;
177 long mleft;
171#define sbspace(sb) \
172 ((long) imin((int)((sb)->sb_hiwat - (sb)->sb_cc), \
173 (int)((sb)->sb_mbmax - (sb)->sb_mbcnt)))
178
174
179 if (sb->sb_flags & SB_STOP)
180 return(0);
181 bleft = sb->sb_hiwat - sb->sb_cc;
182 mleft = sb->sb_mbmax - sb->sb_mbcnt;
183 return((bleft < mleft) ? bleft : mleft);
184}
185
186/* adjust counters in sb reflecting allocation of m */
187#define sballoc(sb, m) { \
188 (sb)->sb_cc += (m)->m_len; \
189 if ((m)->m_type != MT_DATA && (m)->m_type != MT_OOBDATA) \
190 (sb)->sb_ctl += (m)->m_len; \
191 (sb)->sb_mbcnt += MSIZE; \
192 (sb)->sb_mcnt += 1; \
193 if ((m)->m_flags & M_EXT) { \

--- 45 unchanged lines hidden ---
175/* adjust counters in sb reflecting allocation of m */
176#define sballoc(sb, m) { \
177 (sb)->sb_cc += (m)->m_len; \
178 if ((m)->m_type != MT_DATA && (m)->m_type != MT_OOBDATA) \
179 (sb)->sb_ctl += (m)->m_len; \
180 (sb)->sb_mbcnt += MSIZE; \
181 (sb)->sb_mcnt += 1; \
182 if ((m)->m_flags & M_EXT) { \

--- 45 unchanged lines hidden ---