diff options
author | 2010-09-21 01:09:10 +0000 | |
---|---|---|
committer | 2010-09-21 01:09:10 +0000 | |
commit | f93b44b3e48f4dd0c0aedc62090697e24ede730e (patch) | |
tree | b8af3700f14ea0294a59059864f546d4a65d02b7 /sys/kern/kern_malloc.c | |
parent | mclgeti() support for xl(4). All done by Loganaden Velvindron. (diff) | |
download | wireguard-openbsd-f93b44b3e48f4dd0c0aedc62090697e24ede730e.tar.xz wireguard-openbsd-f93b44b3e48f4dd0c0aedc62090697e24ede730e.zip |
Add assertwaitok(9) to declare code paths that assume they can sleep.
Currently only checks that we're not in an interrupt context, but will
soon check that we're not holding any mutexes either.
Update malloc(9) and pool(9) to use assertwaitok(9) as appropriate.
"i like it" art@, oga@, marco@; "i see no harm" deraadt@; too trivial
for me to bother prying actual oks from people.
Diffstat (limited to 'sys/kern/kern_malloc.c')
-rw-r--r-- | sys/kern/kern_malloc.c | 5 |
1 files changed, 4 insertions, 1 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) |