diff options
author | bde <bde@FreeBSD.org> | 1997-03-05 16:45:01 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1997-03-05 16:45:01 +0000 |
commit | e423a3a2761e17fb01665862e3f430a13e8ea83e (patch) | |
tree | 0d65853290cc90d3fcd0ff2aa68643cea80c3cbb /sys | |
parent | 6a14cbe8cc8482b8045354c49cc618596d251b8f (diff) | |
download | FreeBSD-src-e423a3a2761e17fb01665862e3f430a13e8ea83e.zip FreeBSD-src-e423a3a2761e17fb01665862e3f430a13e8ea83e.tar.gz |
Try a no-wait malloc first in clist_alloc_cblocks(). If this fails, then
complain and blunder on.
Should be in 2.2, preferably with a better fix.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/subr_clist.c | 9 | ||||
-rw-r--r-- | sys/kern/tty_subr.c | 9 |
2 files changed, 14 insertions, 4 deletions
diff --git a/sys/kern/subr_clist.c b/sys/kern/subr_clist.c index 7203e02..24091f6 100644 --- a/sys/kern/subr_clist.c +++ b/sys/kern/subr_clist.c @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: tty_subr.c,v 1.25 1997/02/22 09:39:26 peter Exp $ */ /* @@ -131,7 +131,12 @@ cblock_alloc_cblocks(number) struct cblock *cbp; for (i = 0; i < number; ++i) { - cbp = malloc(sizeof *cbp, M_TTYS, M_WAITOK); + cbp = malloc(sizeof *cbp, M_TTYS, M_NOWAIT); + if (cbp == NULL) { + printf( +"clist_alloc_cblocks: M_NOWAIT malloc failed, trying M_WAITOK\n"); + cbp = malloc(sizeof *cbp, M_TTYS, M_WAITOK); + } /* * Freed cblocks have zero quotes and garbage elsewhere. * Set the may-have-quote bit to force zeroing the quotes. diff --git a/sys/kern/tty_subr.c b/sys/kern/tty_subr.c index 7203e02..24091f6 100644 --- a/sys/kern/tty_subr.c +++ b/sys/kern/tty_subr.c @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: tty_subr.c,v 1.25 1997/02/22 09:39:26 peter Exp $ */ /* @@ -131,7 +131,12 @@ cblock_alloc_cblocks(number) struct cblock *cbp; for (i = 0; i < number; ++i) { - cbp = malloc(sizeof *cbp, M_TTYS, M_WAITOK); + cbp = malloc(sizeof *cbp, M_TTYS, M_NOWAIT); + if (cbp == NULL) { + printf( +"clist_alloc_cblocks: M_NOWAIT malloc failed, trying M_WAITOK\n"); + cbp = malloc(sizeof *cbp, M_TTYS, M_WAITOK); + } /* * Freed cblocks have zero quotes and garbage elsewhere. * Set the may-have-quote bit to force zeroing the quotes. |