Deleted Added
full compact
sockbuf.h (271946) sockbuf.h (274421)
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 271946 2014-09-22 08:27:27Z hselasky $
31 * $FreeBSD: head/sys/sys/sockbuf.h 274421 2014-11-12 09:57:15Z glebius $
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

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

161struct mbuf *
162 sbsndmbuf(struct sockbuf *sb, u_int off, u_int *moff);
163void sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb);
164int sbwait(struct sockbuf *sb);
165int sblock(struct sockbuf *sb, int flags);
166void sbunlock(struct sockbuf *sb);
167
168/*
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

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

161struct mbuf *
162 sbsndmbuf(struct sockbuf *sb, u_int off, u_int *moff);
163void sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb);
164int sbwait(struct sockbuf *sb);
165int sblock(struct sockbuf *sb, int flags);
166void sbunlock(struct sockbuf *sb);
167
168/*
169 * Return how much data is available to be taken out of socket
170 * bufffer right now.
171 */
172static inline u_int
173sbavail(struct sockbuf *sb)
174{
175
176#if 0
177 SOCKBUF_LOCK_ASSERT(sb);
178#endif
179 return (sb->sb_cc);
180}
181
182/*
183 * Return how much data sits there in the socket buffer
184 * It might be that some data is not yet ready to be read.
185 */
186static inline u_int
187sbused(struct sockbuf *sb)
188{
189
190#if 0
191 SOCKBUF_LOCK_ASSERT(sb);
192#endif
193 return (sb->sb_cc);
194}
195
196/*
169 * How much space is there in a socket buffer (so->so_snd or so->so_rcv)?
170 * This is problematical if the fields are unsigned, as the space might
171 * still be negative (cc > hiwat or mbcnt > mbmax). Should detect
172 * overflow and return 0. Should use "lmin" but it doesn't exist now.
173 */
174static __inline
175long
176sbspace(struct sockbuf *sb)

--- 64 unchanged lines hidden ---
197 * How much space is there in a socket buffer (so->so_snd or so->so_rcv)?
198 * This is problematical if the fields are unsigned, as the space might
199 * still be negative (cc > hiwat or mbcnt > mbmax). Should detect
200 * overflow and return 0. Should use "lmin" but it doesn't exist now.
201 */
202static __inline
203long
204sbspace(struct sockbuf *sb)

--- 64 unchanged lines hidden ---