uipc_sockbuf.c (40913) | uipc_sockbuf.c (41086) |
---|---|
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 * $Id: uipc_socket2.c,v 1.39 1998/09/05 13:24:39 bde Exp $ | 34 * $Id: uipc_socket2.c,v 1.40 1998/11/04 20:22:11 fenner Exp $ |
35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/domain.h> 40#include <sys/kernel.h> 41#include <sys/proc.h> 42#include <sys/malloc.h> --- 165 unchanged lines hidden (view full) --- 208 return ((struct socket *)0); 209 so->so_head = head; 210 so->so_type = head->so_type; 211 so->so_options = head->so_options &~ SO_ACCEPTCONN; 212 so->so_linger = head->so_linger; 213 so->so_state = head->so_state | SS_NOFDREF; 214 so->so_proto = head->so_proto; 215 so->so_timeo = head->so_timeo; | 35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/domain.h> 40#include <sys/kernel.h> 41#include <sys/proc.h> 42#include <sys/malloc.h> --- 165 unchanged lines hidden (view full) --- 208 return ((struct socket *)0); 209 so->so_head = head; 210 so->so_type = head->so_type; 211 so->so_options = head->so_options &~ SO_ACCEPTCONN; 212 so->so_linger = head->so_linger; 213 so->so_state = head->so_state | SS_NOFDREF; 214 so->so_proto = head->so_proto; 215 so->so_timeo = head->so_timeo; |
216 so->so_pgid = head->so_pgid; | 216 fsetown(fgetown(head->so_sigio), &so->so_sigio); |
217 so->so_uid = head->so_uid; 218 (void) soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat); 219 220 if ((*so->so_proto->pr_usrreqs->pru_attach)(so, 0, NULL)) { 221 sodealloc(so); 222 return ((struct socket *)0); 223 } 224 --- 91 unchanged lines hidden (view full) --- 316 struct proc *p; 317 318 selwakeup(&sb->sb_sel); 319 sb->sb_flags &= ~SB_SEL; 320 if (sb->sb_flags & SB_WAIT) { 321 sb->sb_flags &= ~SB_WAIT; 322 wakeup((caddr_t)&sb->sb_cc); 323 } | 217 so->so_uid = head->so_uid; 218 (void) soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat); 219 220 if ((*so->so_proto->pr_usrreqs->pru_attach)(so, 0, NULL)) { 221 sodealloc(so); 222 return ((struct socket *)0); 223 } 224 --- 91 unchanged lines hidden (view full) --- 316 struct proc *p; 317 318 selwakeup(&sb->sb_sel); 319 sb->sb_flags &= ~SB_SEL; 320 if (sb->sb_flags & SB_WAIT) { 321 sb->sb_flags &= ~SB_WAIT; 322 wakeup((caddr_t)&sb->sb_cc); 323 } |
324 if (so->so_state & SS_ASYNC) { 325 if (so->so_pgid < 0) 326 gsignal(-so->so_pgid, SIGIO); 327 else if (so->so_pgid > 0 && (p = pfind(so->so_pgid)) != 0) 328 psignal(p, SIGIO); 329 } | 324 if ((so->so_state & SS_ASYNC) && so->so_sigio != NULL) 325 pgsigio(so->so_sigio, SIGIO, 0); |
330 if (sb->sb_flags & SB_UPCALL) 331 (*so->so_upcall)(so, so->so_upcallarg, M_DONTWAIT); 332} 333 334/* 335 * Socket buffer (struct sockbuf) utility routines. 336 * 337 * Each socket contains two socket buffers: one for sending data and --- 575 unchanged lines hidden (view full) --- 913 xso->so_pcb = so->so_pcb; 914 xso->xso_protocol = so->so_proto->pr_protocol; 915 xso->xso_family = so->so_proto->pr_domain->dom_family; 916 xso->so_qlen = so->so_qlen; 917 xso->so_incqlen = so->so_incqlen; 918 xso->so_qlimit = so->so_qlimit; 919 xso->so_timeo = so->so_timeo; 920 xso->so_error = so->so_error; | 326 if (sb->sb_flags & SB_UPCALL) 327 (*so->so_upcall)(so, so->so_upcallarg, M_DONTWAIT); 328} 329 330/* 331 * Socket buffer (struct sockbuf) utility routines. 332 * 333 * Each socket contains two socket buffers: one for sending data and --- 575 unchanged lines hidden (view full) --- 909 xso->so_pcb = so->so_pcb; 910 xso->xso_protocol = so->so_proto->pr_protocol; 911 xso->xso_family = so->so_proto->pr_domain->dom_family; 912 xso->so_qlen = so->so_qlen; 913 xso->so_incqlen = so->so_incqlen; 914 xso->so_qlimit = so->so_qlimit; 915 xso->so_timeo = so->so_timeo; 916 xso->so_error = so->so_error; |
921 xso->so_pgid = so->so_pgid; | 917 xso->so_pgid = so->so_sigio ? so->so_sigio->sio_pgid : 0; |
922 xso->so_oobmark = so->so_oobmark; 923 sbtoxsockbuf(&so->so_snd, &xso->so_snd); 924 sbtoxsockbuf(&so->so_rcv, &xso->so_rcv); 925 xso->so_uid = so->so_uid; 926} 927 928/* 929 * This does the same for sockbufs. Note that the xsockbuf structure, --- 32 unchanged lines hidden --- | 918 xso->so_oobmark = so->so_oobmark; 919 sbtoxsockbuf(&so->so_snd, &xso->so_snd); 920 sbtoxsockbuf(&so->so_rcv, &xso->so_rcv); 921 xso->so_uid = so->so_uid; 922} 923 924/* 925 * This does the same for sockbufs. Note that the xsockbuf structure, --- 32 unchanged lines hidden --- |