Deleted Added
full compact
uipc_sockbuf.c (275326) uipc_sockbuf.c (275329)
1/*-
2 * Copyright (c) 1982, 1986, 1988, 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

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

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 * @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93
30 */
31
32#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1982, 1986, 1988, 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

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

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 * @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/kern/uipc_sockbuf.c 275326 2014-11-30 12:52:33Z glebius $");
33__FBSDID("$FreeBSD: head/sys/kern/uipc_sockbuf.c 275329 2014-11-30 13:24:21Z glebius $");
34
35#include "opt_param.h"
36
37#include <sys/param.h>
38#include <sys/aio.h> /* for aio_swake proto */
39#include <sys/kernel.h>
40#include <sys/lock.h>
41#include <sys/mbuf.h>

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

631}
632
633/*
634 * This version of sbappend() should only be used when the caller absolutely
635 * knows that there will never be more than one record in the socket buffer,
636 * that is, a stream protocol (such as TCP).
637 */
638void
34
35#include "opt_param.h"
36
37#include <sys/param.h>
38#include <sys/aio.h> /* for aio_swake proto */
39#include <sys/kernel.h>
40#include <sys/lock.h>
41#include <sys/mbuf.h>

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

631}
632
633/*
634 * This version of sbappend() should only be used when the caller absolutely
635 * knows that there will never be more than one record in the socket buffer,
636 * that is, a stream protocol (such as TCP).
637 */
638void
639sbappendstream_locked(struct sockbuf *sb, struct mbuf *m)
639sbappendstream_locked(struct sockbuf *sb, struct mbuf *m, int flags)
640{
641 SOCKBUF_LOCK_ASSERT(sb);
642
643 KASSERT(m->m_nextpkt == NULL,("sbappendstream 0"));
644 KASSERT(sb->sb_mb == sb->sb_lastrecord,("sbappendstream 1"));
645
646 SBLASTMBUFCHK(sb);
647
648 /* Remove all packet headers and mbuf tags to get a pure data chain. */
640{
641 SOCKBUF_LOCK_ASSERT(sb);
642
643 KASSERT(m->m_nextpkt == NULL,("sbappendstream 0"));
644 KASSERT(sb->sb_mb == sb->sb_lastrecord,("sbappendstream 1"));
645
646 SBLASTMBUFCHK(sb);
647
648 /* Remove all packet headers and mbuf tags to get a pure data chain. */
649 m_demote(m, 1);
650
649 m_demote(m, 1, flags & PRUS_NOTREADY ? M_NOTREADY : 0);
650
651 sbcompress(sb, m, sb->sb_mbtail);
652
653 sb->sb_lastrecord = sb->sb_mb;
654 SBLASTRECORDCHK(sb);
655}
656
657/*
658 * This version of sbappend() should only be used when the caller absolutely
659 * knows that there will never be more than one record in the socket buffer,
660 * that is, a stream protocol (such as TCP).
661 */
662void
651 sbcompress(sb, m, sb->sb_mbtail);
652
653 sb->sb_lastrecord = sb->sb_mb;
654 SBLASTRECORDCHK(sb);
655}
656
657/*
658 * This version of sbappend() should only be used when the caller absolutely
659 * knows that there will never be more than one record in the socket buffer,
660 * that is, a stream protocol (such as TCP).
661 */
662void
663sbappendstream(struct sockbuf *sb, struct mbuf *m)
663sbappendstream(struct sockbuf *sb, struct mbuf *m, int flags)
664{
665
666 SOCKBUF_LOCK(sb);
664{
665
666 SOCKBUF_LOCK(sb);
667 sbappendstream_locked(sb, m);
667 sbappendstream_locked(sb, m, flags);
668 SOCKBUF_UNLOCK(sb);
669}
670
671#ifdef SOCKBUF_DEBUG
672void
673sbcheck(struct sockbuf *sb, const char *file, int line)
674{
675 struct mbuf *m, *n, *fnrdy;

--- 622 unchanged lines hidden ---
668 SOCKBUF_UNLOCK(sb);
669}
670
671#ifdef SOCKBUF_DEBUG
672void
673sbcheck(struct sockbuf *sb, const char *file, int line)
674{
675 struct mbuf *m, *n, *fnrdy;

--- 622 unchanged lines hidden ---