summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_malloc.c5
-rw-r--r--sys/kern/subr_pool.c4
-rw-r--r--sys/kern/subr_xxx.c11
3 files changed, 16 insertions, 4 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index e3bf091a885..986ec8f26d6 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_malloc.c,v 1.84 2010/07/22 06:30:13 matthew Exp $ */
+/* $OpenBSD: kern_malloc.c,v 1.85 2010/09/21 01:09:10 matthew Exp $ */
/* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */
/*
@@ -191,6 +191,9 @@ malloc(unsigned long size, int type, int flags)
panic("malloc - bogus type");
#endif
+ if ((flags & M_NOWAIT) == 0)
+ assertwaitok();
+
#ifdef MALLOC_DEBUG
if (debug_malloc(size, type, flags, (void **)&va)) {
if ((flags & M_ZERO) && va != NULL)
diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c
index 4516c2c1bc9..5b9a354e423 100644
--- a/sys/kern/subr_pool.c
+++ b/sys/kern/subr_pool.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_pool.c,v 1.96 2010/07/03 03:04:55 tedu Exp $ */
+/* $OpenBSD: subr_pool.c,v 1.97 2010/09/21 01:09:10 matthew Exp $ */
/* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */
/*-
@@ -455,7 +455,7 @@ pool_get(struct pool *pp, int flags)
#ifdef DIAGNOSTIC
if ((flags & PR_WAITOK) != 0)
- splassert(IPL_NONE);
+ assertwaitok();
#endif /* DIAGNOSTIC */
mtx_enter(&pp->pr_mtx);
diff --git a/sys/kern/subr_xxx.c b/sys/kern/subr_xxx.c
index 5197f29505a..cb894042b9f 100644
--- a/sys/kern/subr_xxx.c
+++ b/sys/kern/subr_xxx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_xxx.c,v 1.9 2005/12/09 09:09:52 jsg Exp $ */
+/* $OpenBSD: subr_xxx.c,v 1.10 2010/09/21 01:09:10 matthew Exp $ */
/* $NetBSD: subr_xxx.c,v 1.10 1996/02/04 02:16:51 christos Exp $ */
/*
@@ -152,3 +152,12 @@ blktochr(dev_t dev)
return (makedev(i, minor(dev)));
return (NODEV);
}
+
+/*
+ * Check that we're in a context where it's okay to sleep.
+ */
+void
+assertwaitok(void)
+{
+ splassert(IPL_NONE);
+}