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 --- 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 * @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93 |
34 * $FreeBSD: head/sys/kern/uipc_sockbuf.c 51757 1999-09-28 12:59:18Z pb $ |
35 */ 36 37#include "opt_param.h" 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/domain.h> 41#include <sys/file.h> /* for maxfiles */ 42#include <sys/kernel.h> --- 682 unchanged lines hidden (view full) --- 725 */ 726void 727sbflush(sb) 728 register struct sockbuf *sb; 729{ 730 731 if (sb->sb_flags & SB_LOCK) 732 panic("sbflush: locked"); |
733 while (sb->sb_mbcnt) { 734 /* 735 * Don't call sbdrop(sb, 0) if the leading mbuf is non-empty: 736 * we would loop forever. Panic instead. 737 */ 738 if (!sb->sb_cc && (sb->sb_mb == NULL || sb->sb_mb->m_len)) 739 break; |
740 sbdrop(sb, (int)sb->sb_cc); |
741 } |
742 if (sb->sb_cc || sb->sb_mb || sb->sb_mbcnt) 743 panic("sbflush: cc %ld || mb %p || mbcnt %ld", sb->sb_cc, (void *)sb->sb_mb, sb->sb_mbcnt); 744} 745 746/* 747 * Drop data from (the front of) a sockbuf. 748 */ 749void --- 237 unchanged lines hidden --- |