The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/raidframe/rf_debugMem.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: rf_debugMem.h,v 1.11 2003/12/29 03:33:47 oster Exp $   */
    2 /*
    3  * Copyright (c) 1995 Carnegie-Mellon University.
    4  * All rights reserved.
    5  *
    6  * Author: Daniel Stodolsky, Mark Holland
    7  *
    8  * Permission to use, copy, modify and distribute this software and
    9  * its documentation is hereby granted, provided that both the copyright
   10  * notice and this permission notice appear in all copies of the
   11  * software, derivative works or modified versions, and any portions
   12  * thereof, and that both notices appear in supporting documentation.
   13  *
   14  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
   15  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
   16  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   17  *
   18  * Carnegie Mellon requests users of this software to return to
   19  *
   20  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   21  *  School of Computer Science
   22  *  Carnegie Mellon University
   23  *  Pittsburgh PA 15213-3890
   24  *
   25  * any improvements or extensions that they make and grant Carnegie the
   26  * rights to redistribute these changes.
   27  */
   28 
   29 /*
   30  * rf_debugMem.h -- memory leak debugging module
   31  *
   32  * IMPORTANT:  if you put the lock/unlock mutex stuff back in here, you
   33  *             need to take it out of the routines in debugMem.c
   34  *
   35  */
   36 
   37 #ifndef _RF__RF_DEBUGMEM_H_
   38 #define _RF__RF_DEBUGMEM_H_
   39 
   40 #include "rf_alloclist.h"
   41 
   42 #include <sys/types.h>
   43 #include <sys/malloc.h>
   44 
   45 #ifndef RF_DEBUG_MEM
   46 #define RF_DEBUG_MEM 0
   47 #endif
   48 
   49 #if RF_DEBUG_MEM
   50 #define RF_Malloc(_p_, _size_, _cast_)                                      \
   51   {                                                                         \
   52      _p_ = _cast_ malloc((u_long)_size_, M_RAIDFRAME, M_WAITOK);            \
   53      memset((char *)_p_, 0, _size_);                                        \
   54      if (rf_memDebug) rf_record_malloc(_p_, _size_, __LINE__, __FILE__);    \
   55   }
   56 #else
   57 #define RF_Malloc(_p_, _size_, _cast_)                                      \
   58   {                                                                         \
   59      _p_ = _cast_ malloc((u_long)_size_, M_RAIDFRAME, M_WAITOK);            \
   60      memset((char *)_p_, 0, _size_);                                        \
   61   }
   62 #endif
   63 
   64 #define RF_MallocAndAdd(__p_, __size_, __cast_, __alist_)                   \
   65   {                                                                         \
   66      RF_Malloc(__p_, __size_, __cast_);                                     \
   67      if (__alist_) rf_AddToAllocList(__alist_, __p_, __size_);              \
   68   }
   69 
   70 #if RF_DEBUG_MEM
   71 #define RF_Free(_p_, _sz_)                                                  \
   72   {                                                                         \
   73      free((void *)(_p_), M_RAIDFRAME);                                      \
   74      if (rf_memDebug) rf_unrecord_malloc(_p_, (u_int32_t) (_sz_));          \
   75   }
   76 #else
   77 #define RF_Free(_p_, _sz_)                                                  \
   78   {                                                                         \
   79      free((void *)(_p_), M_RAIDFRAME);                                      \
   80   }
   81 #endif
   82 
   83 void    rf_record_malloc(void *p, int size, int line, char *filen);
   84 void    rf_unrecord_malloc(void *p, int sz);
   85 void    rf_print_unfreed(void);
   86 int     rf_ConfigureDebugMem(RF_ShutdownList_t ** listp);
   87 
   88 #endif                          /* !_RF__RF_DEBUGMEM_H_ */

Cache object: a910773fea000912ec0e1b7dc4e91cef


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.