* The part of soreceive() that implements reading non-inline out-of-band * data from a socket. For more complete comments, see soreceive(), from * which this code originated. * * Note that soreceive_rcvoob(), unlike the remainder of soreceive(), is * unable to return an mbuf chain to the caller. */
| 1829 | * unable to return an mbuf chain to the caller. |
| 1830 | */ |
| 1831 | static int |
| 1832 | soreceive_rcvoob(struct socket *so, struct uio *uio, int flags) |
| 1833 | { |
| 1834 | struct protosw *pr = so->so_proto; |
| 1835 | struct mbuf *m; |
| 1836 | int error; |
| 1837 | |
| 1838 | KASSERT(flags & MSG_OOB, ("soreceive_rcvoob: (flags & MSG_OOB) == 0")); |
| 1839 | VNET_SO_ASSERT(so); |
| 1840 | |
| 1841 | m = m_get(M_WAITOK, MT_DATA); |
| 1842 | error = (*pr->pr_usrreqs->pru_rcvoob)(so, m, flags & MSG_PEEK); |
| 1843 | if (error) |
| 1844 | goto bad; |
| 1845 | do { |
| 1846 | error = uiomove(mtod(m, void *), |
| 1847 | (int) min(uio->uio_resid, m->m_len), uio); |
| 1848 | m = m_free(m); |
| 1849 | } while (uio->uio_resid && error == 0 && m); |
| 1850 | bad: |
| 1851 | if (m != NULL) |
| 1852 | m_freem(m); |
| 1853 | return (error); |
| 1854 | } |
| 1855 | |
| 1856 | /* |
| 1857 | * Following replacement or removal of the first mbuf on the first mbuf chain |