X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/d7e50217d7adf6e52786a38bcaa4cd698cb9a79e..4a2492630c73add3c3aa8a805ba4ff343d4a58ea:/bsd/kern/uipc_socket2.c diff --git a/bsd/kern/uipc_socket2.c b/bsd/kern/uipc_socket2.c index 735acaf4c..82e610589 100644 --- a/bsd/kern/uipc_socket2.c +++ b/bsd/kern/uipc_socket2.c @@ -456,6 +456,9 @@ sowakeup(so, sb) } if (sb->sb_flags & SB_UPCALL) (*so->so_upcall)(so, so->so_upcallarg, M_DONTWAIT); + if (sb->sb_flags & SB_KNOTE && + !(sb->sb_sel.si_flags & SI_INITED)) + KNOTE(&sb->sb_sel.si_note, 0); } /* @@ -607,8 +610,10 @@ sbappend(sb, m) kp = sotokextcb(sbtoso(sb)); while (kp) { if (kp->e_sout && kp->e_sout->su_sbappend) { - if ((*kp->e_sout->su_sbappend)(sb, m, kp)) + if ((*kp->e_sout->su_sbappend)(sb, m, kp)) { + KERNEL_DEBUG((DBG_FNC_SBAPPEND | DBG_FUNC_END), sb, sb->sb_cc, kp, 0, 0); return; + } } kp = kp->e_next; } @@ -619,6 +624,7 @@ sbappend(sb, m) do { if (n->m_flags & M_EOR) { sbappendrecord(sb, m); /* XXXXXX!!!! */ + KERNEL_DEBUG((DBG_FNC_SBAPPEND | DBG_FUNC_END), sb, sb->sb_cc, 0, 0, 0); return; } } while (n->m_next && (n = n->m_next)); @@ -945,8 +951,7 @@ sbflush(sb) kp = kp->e_next; } - if (sb->sb_flags & SB_LOCK) - sb_lock(sb); + (void)sblock(sb, M_WAIT); while (sb->sb_mbcnt) { /* * Don't call sbdrop(sb, 0) if the leading mbuf is non-empty: @@ -958,6 +963,9 @@ sbflush(sb) } if (sb->sb_cc || sb->sb_mb || sb->sb_mbcnt) panic("sbflush: cc %ld || mb %p || mbcnt %ld", sb->sb_cc, (void *)sb->sb_mb, sb->sb_mbcnt); + + sbunlock(sb); + postevent(0, sb, EV_RWBYTES); } @@ -986,8 +994,10 @@ sbdrop(sb, len) kp = sotokextcb(sbtoso(sb)); while (kp) { if (kp->e_sout && kp->e_sout->su_sbdrop) { - if ((*kp->e_sout->su_sbdrop)(sb, len, kp)) + if ((*kp->e_sout->su_sbdrop)(sb, len, kp)) { + KERNEL_DEBUG((DBG_FNC_SBDROP | DBG_FUNC_END), sb, len, kp, 0, 0); return; + } } kp = kp->e_next; } @@ -1278,7 +1288,7 @@ int pru_sopoll_notsupp(struct socket *so, int events, int sb_notify(struct sockbuf *sb) { - return ((sb->sb_flags & (SB_WAIT|SB_SEL|SB_ASYNC|SB_UPCALL)) != 0); + return ((sb->sb_flags & (SB_WAIT|SB_SEL|SB_ASYNC|SB_UPCALL|SB_KNOTE)) != 0); } /*