uipc_sockbuf.c (191366) | uipc_sockbuf.c (193272) |
---|---|
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 191366 2009-04-21 19:14:13Z emax $"); | 33__FBSDID("$FreeBSD: head/sys/kern/uipc_sockbuf.c 193272 2009-06-01 21:17:03Z jhb $"); |
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> --- 128 unchanged lines hidden (view full) --- 170 * to the point where it's no longer required. We currently hold the lock 171 * through calls out to other subsystems (with the exception of kqueue), and 172 * then release it to avoid lock order issues. It's not clear that's 173 * correct. 174 */ 175void 176sowakeup(struct socket *so, struct sockbuf *sb) 177{ | 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> --- 128 unchanged lines hidden (view full) --- 170 * to the point where it's no longer required. We currently hold the lock 171 * through calls out to other subsystems (with the exception of kqueue), and 172 * then release it to avoid lock order issues. It's not clear that's 173 * correct. 174 */ 175void 176sowakeup(struct socket *so, struct sockbuf *sb) 177{ |
178 int ret; |
|
178 179 SOCKBUF_LOCK_ASSERT(sb); 180 181 selwakeuppri(&sb->sb_sel, PSOCK); 182 if (!SEL_WAITING(&sb->sb_sel)) 183 sb->sb_flags &= ~SB_SEL; 184 if (sb->sb_flags & SB_WAIT) { 185 sb->sb_flags &= ~SB_WAIT; 186 wakeup(&sb->sb_cc); 187 } 188 KNOTE_LOCKED(&sb->sb_sel.si_note, 0); | 179 180 SOCKBUF_LOCK_ASSERT(sb); 181 182 selwakeuppri(&sb->sb_sel, PSOCK); 183 if (!SEL_WAITING(&sb->sb_sel)) 184 sb->sb_flags &= ~SB_SEL; 185 if (sb->sb_flags & SB_WAIT) { 186 sb->sb_flags &= ~SB_WAIT; 187 wakeup(&sb->sb_cc); 188 } 189 KNOTE_LOCKED(&sb->sb_sel.si_note, 0); |
190 if (sb->sb_upcall != NULL) { 191 ret = sb->sb_upcall(so, sb->sb_upcallarg, M_DONTWAIT); 192 if (ret == SU_ISCONNECTED) { 193 KASSERT(sb == &so->so_rcv, 194 ("SO_SND upcall returned SU_ISCONNECTED")); 195 soupcall_clear(so, SO_RCV); 196 } 197 } else 198 ret = SU_OK; 199 if (sb->sb_flags & SB_AIO) 200 aio_swake(so, sb); |
|
189 SOCKBUF_UNLOCK(sb); | 201 SOCKBUF_UNLOCK(sb); |
202 if (ret == SU_ISCONNECTED) 203 soisconnected(so); |
|
190 if ((so->so_state & SS_ASYNC) && so->so_sigio != NULL) 191 pgsigio(&so->so_sigio, SIGIO, 0); | 204 if ((so->so_state & SS_ASYNC) && so->so_sigio != NULL) 205 pgsigio(&so->so_sigio, SIGIO, 0); |
192 if (sb->sb_flags & SB_UPCALL) 193 (*so->so_upcall)(so, so->so_upcallarg, M_DONTWAIT); 194 if (sb->sb_flags & SB_AIO) 195 aio_swake(so, sb); | |
196 mtx_assert(SOCKBUF_MTX(sb), MA_NOTOWNED); 197} 198 199/* 200 * Socket buffer (struct sockbuf) utility routines. 201 * 202 * Each socket contains two socket buffers: one for sending data and one for 203 * receiving data. Each buffer contains a queue of mbufs, information about --- 838 unchanged lines hidden --- | 206 mtx_assert(SOCKBUF_MTX(sb), MA_NOTOWNED); 207} 208 209/* 210 * Socket buffer (struct sockbuf) utility routines. 211 * 212 * Each socket contains two socket buffers: one for sending data and one for 213 * receiving data. Each buffer contains a queue of mbufs, information about --- 838 unchanged lines hidden --- |