From 925e59ac150aeb0f9142eb58d73baef0a85415ea Mon Sep 17 00:00:00 2001 From: art Date: Fri, 20 Dec 2002 06:00:53 +0000 Subject: Add a special malloc type M_DEBUG. If the kernel is compiled with MALLOC_DEBUG, M_DEBUG will force the allocation to be done through malloc_debug. --- sys/kern/kern_malloc_debug.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sys/kern/kern_malloc_debug.c') diff --git a/sys/kern/kern_malloc_debug.c b/sys/kern/kern_malloc_debug.c index c31aa4adc96..beffe411edf 100644 --- a/sys/kern/kern_malloc_debug.c +++ b/sys/kern/kern_malloc_debug.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_malloc_debug.c,v 1.20 2002/12/05 22:32:04 art Exp $ */ +/* $OpenBSD: kern_malloc_debug.c,v 1.21 2002/12/20 06:00:53 art Exp $ */ /* * Copyright (c) 1999, 2000 Artur Grabowski @@ -115,11 +115,11 @@ debug_malloc(unsigned long size, int type, int flags, void **addr) int s, wait = flags & M_NOWAIT; /* Careful not to compare unsigned long to int -1 */ - if ((type != debug_malloc_type && debug_malloc_type != 0) || + if (((type != debug_malloc_type && debug_malloc_type != 0) || (size != debug_malloc_size && debug_malloc_size != 0) || (debug_malloc_size_lo != -1 && size < debug_malloc_size_lo) || (debug_malloc_size_hi != -1 && size > debug_malloc_size_hi) || - !debug_malloc_initialized) + !debug_malloc_initialized) && type != M_DEBUG) return (0); /* XXX - fix later */ @@ -163,7 +163,8 @@ debug_free(void *addr, int type) vaddr_t va; int s; - if (type != debug_malloc_type && debug_malloc_type != 0) + if (type != debug_malloc_type && debug_malloc_type != 0 && + type != M_DEBUG) return (0); /* -- cgit v1.2.3-59-g8ed1b