Fix memory tracking
authorGé van Geldorp <ge@gse.nl>
Sun, 1 Jan 2006 11:48:11 +0000 (11:48 +0000)
committerGé van Geldorp <ge@gse.nl>
Sun, 1 Jan 2006 11:48:11 +0000 (11:48 +0000)
svn path=/trunk/; revision=20505

reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/malloc.h
reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/mbuf.h
reactos/drivers/lib/oskittcp/include/oskitfreebsd.h
reactos/drivers/lib/oskittcp/include/oskittcp.h
reactos/drivers/lib/oskittcp/oskittcp.xml
reactos/drivers/lib/oskittcp/oskittcp/interface.c

index 8a44caa..ae4a946 100644 (file)
@@ -329,8 +329,8 @@ extern struct kmembuckets bucket[];
 extern void *malloc __P((unsigned long size, ...));
 extern void free __P((void *addr, ...));
 #else
-#define malloc fbsd_malloc
-#define free   fbsd_free
+#define malloc(size, flags, id) fbsd_malloc(size, __FILE__, __LINE__)
+#define free(area, flags)   fbsd_free(area, __FILE__, __LINE__)
 #endif
 #endif /* KERNEL */
 #endif /* !_SYS_MALLOC_H_ */
index c421987..b3226e9 100644 (file)
@@ -304,7 +304,7 @@ union mcluster {
 #ifdef __REACTOS__
 #define MCLGET(m, how) { \
           OS_DbgPrint(OSK_MID_TRACE,("(MCLGET) m = %x\n", m)); \
-          (m)->m_ext.ext_buf = malloc(MCLBYTES); \
+          (m)->m_ext.ext_buf = malloc(MCLBYTES,__FILE__,__LINE__); \
          if ((m)->m_ext.ext_buf != NULL) { \
               (m)->m_data = (m)->m_ext.ext_buf; \
               (m)->m_flags |= M_EXT; \
@@ -313,7 +313,7 @@ union mcluster {
         }
 
 #define MCLFREE(p) { \
-          free( (p) ); \
+          free( (p), 0 ); \
         }
 #else
 #define        MCLGET(m, how) \
index 7d0f236..53345af 100644 (file)
@@ -30,6 +30,6 @@ static __inline void panic ( const char* fmt, ... )
 #define panic(...) do { printf(__VA_ARGS__); \
         oskittcp_die(__FILE__,__LINE__); } while(0)
 #endif//_MSC_VER
-#define kmem_malloc(x,y,z) malloc(y)
+#define kmem_malloc(x,y,z) malloc(y,0,0)
 
 #endif//_OSKITFREEBSD_H
index d00535e..0971f50 100644 (file)
@@ -155,8 +155,8 @@ void OskitTCPGetAddress( void *socket,
 
 #undef errno
 
-void *fbsd_malloc( unsigned int bytes, ... );
-void fbsd_free( void *data, ... );
+void *fbsd_malloc( unsigned int bytes, char *file, unsigned line, ... );
+void fbsd_free( void *data, char *file, unsigned line, ... );
 #if 0
 #define malloc(x) fbsd_malloc(x,__FILE__,__LINE__)
 #define free(x) fbsd_free(x,__FILE__,__LINE__)
index b762fb0..5c47b96 100644 (file)
@@ -5,6 +5,7 @@
        <define name="_DISABLE_TIDENTS"/>
        <define name="__USE_W32API"/>
        <define name="__NO_CTYPE_INLINES" />
+       <define name="MEMTRACK" />
        <include>drivers/lib/oskittcp/include/freebsd</include>
        <include>drivers/lib/oskittcp/include/freebsd/sys/include</include>
        <include>drivers/lib/oskittcp/include/freebsd/src/sys</include>
index 5da5c22..fd82994 100644 (file)
@@ -33,15 +33,15 @@ void clock_init();
 int isprint(int c);
 int _snprintf(char * buf, size_t cnt, const char *fmt, ...);
 
-void *fbsd_malloc( unsigned int bytes, ... ) {
+void *fbsd_malloc( unsigned int bytes, char *file, unsigned line, ... ) {
     if( !OtcpEvent.TCPMalloc ) panic("no malloc");
     return OtcpEvent.TCPMalloc
-       ( OtcpEvent.ClientData, (OSK_UINT)bytes, "*", 0 );
+       ( OtcpEvent.ClientData, (OSK_UINT)bytes, file, line );
 }
 
-void fbsd_free( void *data, ... ) {
+void fbsd_free( void *data, char *file, unsigned line, ... ) {
     if( !OtcpEvent.TCPFree ) panic("no free");
-    OtcpEvent.TCPFree( OtcpEvent.ClientData, data, "*", 0 );
+    OtcpEvent.TCPFree( OtcpEvent.ClientData, data, file, line );
 }
 
 void InitOskitTCP() {