diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_malloc.c | 3 | ||||
-rw-r--r-- | sys/sys/malloc.h | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index a2e77fd..f268be6 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -280,6 +280,9 @@ out: ksp->ks_maxused = ksp->ks_memuse; splx(s); mtx_exit(&malloc_mtx, MTX_DEF); + /* XXX: Do idle pre-zeroing. */ + if (va != NULL && (flags & M_ZERO)) + bzero(va, size); return ((void *) va); } diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h index 3ea2012..935ec3e 100644 --- a/sys/sys/malloc.h +++ b/sys/sys/malloc.h @@ -46,6 +46,7 @@ #define M_NOWAIT 0x0001 /* do not block */ #define M_USE_RESERVE 0x0002 /* can alloc out of reserve memory */ #define M_ASLEEP 0x0004 /* async sleep on failure */ +#define M_ZERO 0x0008 /* bzero the allocation */ #define M_MAGIC 877983977 /* time when first defined :-) */ |