From 1e818041a24e6002c9ec32181f7670b29bdc323b Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Thu, 20 Jun 1996 10:53:10 +0000 Subject: kern_malloc() can fail in canwait case if no more map space; return NULL in that case so that callers can deal with shortage rather than deadlocking. --- sys/vm/vm_kern.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'sys/vm/vm_kern.c') diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index 5b578fa3238..c5475f0d1f8 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -1,4 +1,4 @@ -/* $NetBSD: vm_kern.c,v 1.17 1995/04/10 16:53:55 mycroft Exp $ */ +/* $NetBSD: vm_kern.c,v 1.17.6.1 1996/06/13 17:21:28 cgd Exp $ */ /* * Copyright (c) 1991, 1993 @@ -297,9 +297,14 @@ kmem_malloc(map, size, canwait) vm_map_lock(map); if (vm_map_findspace(map, 0, size, &addr)) { vm_map_unlock(map); - if (canwait) /* XXX should wait */ - panic("kmem_malloc: %s too small", - map == kmem_map ? "kmem_map" : "mb_map"); + /* + * Should wait, but that makes no sense since we will + * likely never wake up unless action to free resources + * is taken by the calling subsystem. + * + * We return NULL, and if the caller was able to wait + * then they should take corrective action and retry. + */ return (0); } offset = addr - vm_map_min(kmem_map); -- cgit v1.2.3