diff options
author | green <green@FreeBSD.org> | 1999-12-12 05:52:51 +0000 |
---|---|---|
committer | green <green@FreeBSD.org> | 1999-12-12 05:52:51 +0000 |
commit | 56a46611e10209f4a55ba809f58b91f7db2b60b4 (patch) | |
tree | a18fc22a78afce419dacc6ec6f2b867caf2d0922 /sys/kern/uipc_socket.c | |
parent | 8fc09c011cc5df71c6f1ab5510dee8133224bbb4 (diff) | |
download | FreeBSD-src-56a46611e10209f4a55ba809f58b91f7db2b60b4.zip FreeBSD-src-56a46611e10209f4a55ba809f58b91f7db2b60b4.tar.gz |
This is Bosko Milekic's mbuf allocation waiting code. Basically, this
means that running out of mbuf space isn't a panic anymore, and code
which runs out of network memory will sleep to wait for it.
Submitted by: Bosko Milekic <bmilekic@dsuper.net>
Reviewed by: green, wollman
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r-- | sys/kern/uipc_socket.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index c6d107c..9e4fa56 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -507,11 +507,19 @@ restart: } else do { if (top == 0) { MGETHDR(m, M_WAIT, MT_DATA); + if (m == NULL) { + error = ENOBUFS; + goto release; + } mlen = MHLEN; m->m_pkthdr.len = 0; m->m_pkthdr.rcvif = (struct ifnet *)0; } else { MGET(m, M_WAIT, MT_DATA); + if (m == NULL) { + error = ENOBUFS; + goto release; + } mlen = MLEN; } if (resid >= MINCLSIZE) { @@ -636,6 +644,10 @@ soreceive(so, psa, uio, mp0, controlp, flagsp) flags = 0; if (flags & MSG_OOB) { m = m_get(M_WAIT, MT_DATA); + if (m == NULL) { + error = ENOBUFS; + goto release; + } error = (*pr->pr_usrreqs->pru_rcvoob)(so, m, flags & MSG_PEEK); if (error) goto bad; |