diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_malloc.c | 4 | ||||
-rw-r--r-- | sys/kern/subr_pool.c | 4 | ||||
-rw-r--r-- | sys/sys/malloc.h | 10 | ||||
-rw-r--r-- | sys/sys/pool.h | 19 |
4 files changed, 20 insertions, 17 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 986ec8f26d6..9660ca1d297 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_malloc.c,v 1.85 2010/09/21 01:09:10 matthew Exp $ */ +/* $OpenBSD: kern_malloc.c,v 1.86 2010/09/26 21:03:56 tedu Exp $ */ /* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */ /* @@ -191,6 +191,8 @@ malloc(unsigned long size, int type, int flags) panic("malloc - bogus type"); #endif + KASSERT(flags & (M_WAITOK | M_NOWAIT)); + if ((flags & M_NOWAIT) == 0) assertwaitok(); diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c index 5b9a354e423..59935c1f672 100644 --- a/sys/kern/subr_pool.c +++ b/sys/kern/subr_pool.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_pool.c,v 1.97 2010/09/21 01:09:10 matthew Exp $ */ +/* $OpenBSD: subr_pool.c,v 1.98 2010/09/26 21:03:57 tedu Exp $ */ /* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */ /*- @@ -453,6 +453,8 @@ pool_get(struct pool *pp, int flags) { void *v; + KASSERT(flags & (PR_WAITOK | PR_NOWAIT)); + #ifdef DIAGNOSTIC if ((flags & PR_WAITOK) != 0) assertwaitok(); diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h index f5026ef7a8f..3233858aabe 100644 --- a/sys/sys/malloc.h +++ b/sys/sys/malloc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.h,v 1.97 2010/07/14 10:31:54 matthew Exp $ */ +/* $OpenBSD: malloc.h,v 1.98 2010/09/26 21:03:57 tedu Exp $ */ /* $NetBSD: malloc.h,v 1.39 1998/07/12 19:52:01 augustss Exp $ */ /* @@ -52,10 +52,10 @@ /* * flags to malloc */ -#define M_WAITOK 0x0000 -#define M_NOWAIT 0x0001 -#define M_CANFAIL 0x0002 -#define M_ZERO 0x0004 +#define M_WAITOK 0x0001 +#define M_NOWAIT 0x0002 +#define M_CANFAIL 0x0004 +#define M_ZERO 0x0008 /* * Types of memory to be allocated diff --git a/sys/sys/pool.h b/sys/sys/pool.h index b1a471ad20c..db9c9bebaa8 100644 --- a/sys/sys/pool.h +++ b/sys/sys/pool.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pool.h,v 1.35 2010/07/13 16:47:02 deraadt Exp $ */ +/* $OpenBSD: pool.h,v 1.36 2010/09/26 21:03:57 tedu Exp $ */ /* $NetBSD: pool.h,v 1.27 2001/06/06 22:00:17 rafal Exp $ */ /*- @@ -91,15 +91,14 @@ struct pool { const char *pr_wchan; /* tsleep(9) identifier */ unsigned int pr_flags; /* r/w flags */ unsigned int pr_roflags; /* r/o flags */ -#define PR_MALLOCOK 0x01 -#define PR_NOWAIT 0x00 /* for symmetry */ -#define PR_WAITOK 0x02 -#define PR_WANTED 0x04 -#define PR_PHINPAGE 0x08 -#define PR_LOGGING 0x10 -#define PR_LIMITFAIL 0x20 /* even if waiting, fail if we hit limit */ -#define PR_DEBUG 0x40 -#define PR_ZERO 0x100 +#define PR_WAITOK 0x0001 /* M_WAITOK */ +#define PR_NOWAIT 0x0002 /* M_NOWAIT */ +#define PR_LIMITFAIL 0x0004 /* M_CANFAIL */ +#define PR_ZERO 0x0008 /* M_ZERO */ +#define PR_WANTED 0x0100 +#define PR_PHINPAGE 0x0200 +#define PR_LOGGING 0x0400 +#define PR_DEBUG 0x0800 int pr_ipl; |