uipc_sockbuf.c (110268) | uipc_sockbuf.c (111119) |
---|---|
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 | 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 110268 2003-02-03 06:50:59Z harti $ | 34 * $FreeBSD: head/sys/kern/uipc_sockbuf.c 111119 2003-02-19 05:47:46Z imp $ |
35 */ 36 37#include "opt_mac.h" 38#include "opt_param.h" 39 40#include <sys/param.h> 41#include <sys/aio.h> /* for aio_swake proto */ 42#include <sys/domain.h> --- 267 unchanged lines hidden (view full) --- 310 sb->sb_flags &= ~SB_SEL; 311 if (sb->sb_flags & SB_WAIT) { 312 sb->sb_flags &= ~SB_WAIT; 313 wakeup(&sb->sb_cc); 314 } 315 if ((so->so_state & SS_ASYNC) && so->so_sigio != NULL) 316 pgsigio(&so->so_sigio, SIGIO, 0); 317 if (sb->sb_flags & SB_UPCALL) | 35 */ 36 37#include "opt_mac.h" 38#include "opt_param.h" 39 40#include <sys/param.h> 41#include <sys/aio.h> /* for aio_swake proto */ 42#include <sys/domain.h> --- 267 unchanged lines hidden (view full) --- 310 sb->sb_flags &= ~SB_SEL; 311 if (sb->sb_flags & SB_WAIT) { 312 sb->sb_flags &= ~SB_WAIT; 313 wakeup(&sb->sb_cc); 314 } 315 if ((so->so_state & SS_ASYNC) && so->so_sigio != NULL) 316 pgsigio(&so->so_sigio, SIGIO, 0); 317 if (sb->sb_flags & SB_UPCALL) |
318 (*so->so_upcall)(so, so->so_upcallarg, M_NOWAIT); | 318 (*so->so_upcall)(so, so->so_upcallarg, M_DONTWAIT); |
319 if (sb->sb_flags & SB_AIO) 320 aio_swake(so, sb); 321 KNOTE(&sb->sb_sel.si_note, 0); 322} 323 324/* 325 * Socket buffer (struct sockbuf) utility routines. 326 * --- 294 unchanged lines hidden (view full) --- 621 panic("sbappendaddr"); 622 if (m0) 623 space += m0->m_pkthdr.len; 624 space += m_length(control, &n); 625 if (space > sbspace(sb)) 626 return (0); 627 if (asa->sa_len > MLEN) 628 return (0); | 319 if (sb->sb_flags & SB_AIO) 320 aio_swake(so, sb); 321 KNOTE(&sb->sb_sel.si_note, 0); 322} 323 324/* 325 * Socket buffer (struct sockbuf) utility routines. 326 * --- 294 unchanged lines hidden (view full) --- 621 panic("sbappendaddr"); 622 if (m0) 623 space += m0->m_pkthdr.len; 624 space += m_length(control, &n); 625 if (space > sbspace(sb)) 626 return (0); 627 if (asa->sa_len > MLEN) 628 return (0); |
629 MGET(m, M_NOWAIT, MT_SONAME); | 629 MGET(m, M_DONTWAIT, MT_SONAME); |
630 if (m == 0) 631 return (0); 632 m->m_len = asa->sa_len; 633 bcopy(asa, mtod(m, caddr_t), asa->sa_len); 634 if (n) 635 n->m_next = m0; /* concatenate data to control */ 636 else 637 control = m0; --- 190 unchanged lines hidden (view full) --- 828 register int size; 829 int type, level; 830{ 831 register struct cmsghdr *cp; 832 struct mbuf *m; 833 834 if (CMSG_SPACE((u_int)size) > MCLBYTES) 835 return ((struct mbuf *) NULL); | 630 if (m == 0) 631 return (0); 632 m->m_len = asa->sa_len; 633 bcopy(asa, mtod(m, caddr_t), asa->sa_len); 634 if (n) 635 n->m_next = m0; /* concatenate data to control */ 636 else 637 control = m0; --- 190 unchanged lines hidden (view full) --- 828 register int size; 829 int type, level; 830{ 831 register struct cmsghdr *cp; 832 struct mbuf *m; 833 834 if (CMSG_SPACE((u_int)size) > MCLBYTES) 835 return ((struct mbuf *) NULL); |
836 if ((m = m_get(M_NOWAIT, MT_CONTROL)) == NULL) | 836 if ((m = m_get(M_DONTWAIT, MT_CONTROL)) == NULL) |
837 return ((struct mbuf *) NULL); 838 if (CMSG_SPACE((u_int)size) > MLEN) { | 837 return ((struct mbuf *) NULL); 838 if (CMSG_SPACE((u_int)size) > MLEN) { |
839 MCLGET(m, M_NOWAIT); | 839 MCLGET(m, M_DONTWAIT); |
840 if ((m->m_flags & M_EXT) == 0) { 841 m_free(m); 842 return ((struct mbuf *) NULL); 843 } 844 } 845 cp = mtod(m, struct cmsghdr *); 846 m->m_len = 0; 847 KASSERT(CMSG_SPACE((u_int)size) <= M_TRAILINGSPACE(m), --- 71 unchanged lines hidden (view full) --- 919struct sockaddr * 920dup_sockaddr(sa, canwait) 921 struct sockaddr *sa; 922 int canwait; 923{ 924 struct sockaddr *sa2; 925 926 MALLOC(sa2, struct sockaddr *, sa->sa_len, M_SONAME, | 840 if ((m->m_flags & M_EXT) == 0) { 841 m_free(m); 842 return ((struct mbuf *) NULL); 843 } 844 } 845 cp = mtod(m, struct cmsghdr *); 846 m->m_len = 0; 847 KASSERT(CMSG_SPACE((u_int)size) <= M_TRAILINGSPACE(m), --- 71 unchanged lines hidden (view full) --- 919struct sockaddr * 920dup_sockaddr(sa, canwait) 921 struct sockaddr *sa; 922 int canwait; 923{ 924 struct sockaddr *sa2; 925 926 MALLOC(sa2, struct sockaddr *, sa->sa_len, M_SONAME, |
927 canwait ? 0 : M_NOWAIT); | 927 canwait ? M_WAITOK : M_NOWAIT); |
928 if (sa2) 929 bcopy(sa, sa2, sa->sa_len); 930 return sa2; 931} 932 933/* 934 * Create an external-format (``xsocket'') structure using the information 935 * in the kernel-format socket structure pointed to by so. This is done --- 72 unchanged lines hidden --- | 928 if (sa2) 929 bcopy(sa, sa2, sa->sa_len); 930 return sa2; 931} 932 933/* 934 * Create an external-format (``xsocket'') structure using the information 935 * in the kernel-format socket structure pointed to by so. This is done --- 72 unchanged lines hidden --- |