kern_malloc.c (129906) | kern_malloc.c (131927) |
---|---|
1/* 2 * Copyright (c) 1987, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94 30 */ 31 32#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 1987, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/kern/kern_malloc.c 129906 2004-05-31 21:46:06Z bmilekic $"); | 33__FBSDID("$FreeBSD: head/sys/kern/kern_malloc.c 131927 2004-07-10 21:36:01Z marcel $"); |
34 35#include "opt_vm.h" 36 37#include <sys/param.h> 38#include <sys/systm.h> | 34 35#include "opt_vm.h" 36 37#include <sys/param.h> 38#include <sys/systm.h> |
39#include <sys/kdb.h> |
|
39#include <sys/kernel.h> 40#include <sys/lock.h> 41#include <sys/malloc.h> 42#include <sys/mbuf.h> 43#include <sys/mutex.h> 44#include <sys/vmmeter.h> 45#include <sys/proc.h> 46#include <sys/sysctl.h> --- 156 unchanged lines hidden (view full) --- 203 * one, and check against the API botches that are common. 204 */ 205 indx = flags & (M_WAITOK | M_NOWAIT | M_DONTWAIT | M_TRYWAIT); 206 if (indx != M_NOWAIT && indx != M_WAITOK) { 207 static struct timeval lasterr; 208 static int curerr, once; 209 if (once == 0 && ppsratecheck(&lasterr, &curerr, 1)) { 210 printf("Bad malloc flags: %x\n", indx); | 40#include <sys/kernel.h> 41#include <sys/lock.h> 42#include <sys/malloc.h> 43#include <sys/mbuf.h> 44#include <sys/mutex.h> 45#include <sys/vmmeter.h> 46#include <sys/proc.h> 47#include <sys/sysctl.h> --- 156 unchanged lines hidden (view full) --- 204 * one, and check against the API botches that are common. 205 */ 206 indx = flags & (M_WAITOK | M_NOWAIT | M_DONTWAIT | M_TRYWAIT); 207 if (indx != M_NOWAIT && indx != M_WAITOK) { 208 static struct timeval lasterr; 209 static int curerr, once; 210 if (once == 0 && ppsratecheck(&lasterr, &curerr, 1)) { 211 printf("Bad malloc flags: %x\n", indx); |
211 backtrace(); | 212 kdb_backtrace(); |
212 flags |= M_WAITOK; 213 once++; 214 } 215 } 216#endif 217#if 0 218 if (size == 0) | 213 flags |= M_WAITOK; 214 once++; 215 } 216 } 217#endif 218#if 0 219 if (size == 0) |
219 Debugger("zero size malloc"); | 220 kdb_enter("zero size malloc"); |
220#endif 221#ifdef MALLOC_MAKE_FAILURES 222 if ((flags & M_NOWAIT) && (malloc_failure_rate != 0)) { 223 atomic_add_int(&malloc_nowait_count, 1); 224 if ((malloc_nowait_count % malloc_failure_rate) == 0) { 225 atomic_add_int(&malloc_failure_count, 1); 226 t_malloc_fail = time_uptime; 227 return (NULL); --- 453 unchanged lines hidden --- | 221#endif 222#ifdef MALLOC_MAKE_FAILURES 223 if ((flags & M_NOWAIT) && (malloc_failure_rate != 0)) { 224 atomic_add_int(&malloc_nowait_count, 1); 225 if ((malloc_nowait_count % malloc_failure_rate) == 0) { 226 atomic_add_int(&malloc_failure_count, 1); 227 t_malloc_fail = time_uptime; 228 return (NULL); --- 453 unchanged lines hidden --- |