| 1183 | } |
| 1184 | |
| 1185 | static bool |
| 1186 | uipc_ready_scan(struct socket *so, struct mbuf *m, int count, int *errorp) |
| 1187 | { |
| 1188 | struct mbuf *mb, *n; |
| 1189 | struct sockbuf *sb; |
| 1190 | |
| 1191 | SOCK_LOCK(so); |
| 1192 | if (SOLISTENING(so)) { |
| 1193 | SOCK_UNLOCK(so); |
| 1194 | return (false); |
| 1195 | } |
| 1196 | mb = NULL; |
| 1197 | sb = &so->so_rcv; |
| 1198 | SOCKBUF_LOCK(sb); |
| 1199 | if (sb->sb_fnrdy != NULL) { |
| 1200 | for (mb = sb->sb_mb, n = mb->m_nextpkt; mb != NULL;) { |
| 1201 | if (mb == m) { |
| 1202 | *errorp = sbready(sb, m, count); |
| 1203 | break; |
| 1204 | } |
| 1205 | mb = mb->m_next; |
| 1206 | if (mb == NULL) { |
| 1207 | mb = n; |
| 1208 | if (mb != NULL) |
| 1209 | n = mb->m_nextpkt; |
| 1210 | } |
| 1211 | } |
| 1212 | } |
| 1213 | SOCKBUF_UNLOCK(sb); |
| 1214 | SOCK_UNLOCK(so); |
| 1215 | return (mb != NULL); |
| 1216 | } |
| 1217 | |
| 1218 | static int |
| 1219 | uipc_ready(struct socket *so, struct mbuf *m, int count) |