]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
USR2 is used to enable tracing
authorkostas <>
Fri, 27 Feb 1998 14:24:55 +0000 (14:24 +0000)
committerkostas <>
Fri, 27 Feb 1998 14:24:55 +0000 (14:24 +0000)
lib/util.c
src/main.cc
src/tools.cc

index 2d1899cbcc0f84c2e2eccd7aeed39626d15fa302..3095cac1696fde7621fd0ae86bd71e324bf75067 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: util.c,v 1.48 1998/02/27 07:13:53 kostas Exp $
+ * $Id: util.c,v 1.49 1998/02/27 07:24:55 kostas Exp $
  *
  * DEBUG: 
  * AUTHOR: Harvest Derived
@@ -141,7 +141,7 @@ extern int sys_nerr;
 
 #if MEM_GEN_TRACE
 
-static FILE *tracefp;
+static FILE *tracefp=NULL;
 
 void
 log_trace_init(char *fn)
@@ -157,6 +157,7 @@ void
 log_trace_done()
 {
         fclose(tracefp);
+       tracefp=NULL;
 }
 
 #endif
@@ -492,6 +493,7 @@ xmalloc(size_t sz)
     xmalloc_show_trace(p, 1);
 #endif
 #if MEM_GEN_TRACE
+       if (tracefp)
        fprintf(tracefp, "m:%d:%p\n",sz,p);
 #endif
     return (p);
@@ -513,6 +515,7 @@ xfree(void *s)
     if (s != NULL)
        free(s);
 #if MEM_GEN_TRACE
+       if (tracefp)
     fprintf(tracefp,"f:%p\n",s);
 #endif
 }
@@ -529,6 +532,7 @@ xxfree(void *s)
 #endif
     free(s);
 #if MEM_GEN_TRACE
+       if (tracefp)
     fprintf(tracefp,"f:%p\n",s);
 #endif
 }
@@ -603,6 +607,7 @@ xcalloc(int n, size_t sz)
     xmalloc_show_trace(p, 1);
 #endif
 #if MEM_GEN_TRACE
+       if (tracefp)
        fprintf(tracefp,"c:%d:%d:%p\n", n, sz,p);
 #endif
     return (p);
index 169d69ed6ef02c6fddde789971f5a175c92264ad..521b4699a12c5bc6a27a8e273a004db4d5f4d305 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: main.cc,v 1.228 1998/02/27 05:51:15 kostas Exp $
+ * $Id: main.cc,v 1.229 1998/02/27 07:24:56 kostas Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -513,9 +513,6 @@ main(int argc, char **argv)
     int errcount = 0;
     int n;                     /* # of GC'd objects */
     time_t loop_delay;
-#if MEM_GEN_TRACE
-    log_trace_init("/tmp/squid.alloc");
-#endif
 
     debug_log = stderr;
     if (FD_SETSIZE < Squid_MaxFD)
index 6cb4802fec0e73db4076748c718e3b0ebd140472..c94cbc4f908182256a4310bd9a875ce8d6e9043c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tools.cc,v 1.147 1998/02/06 17:50:27 wessels Exp $
+ * $Id: tools.cc,v 1.148 1998/02/27 07:24:57 kostas Exp $
  *
  * DEBUG: section 21    Misc Functions
  * AUTHOR: Harvest Derived
@@ -122,6 +122,10 @@ static void shutdownTimeoutHandler(int fd, void *data);
 #if USE_ASYNC_IO
 static void safeunlinkComplete(void *data, int retcode, int errcode);
 #endif
+#if MEM_GEN_TRACE
+extern void log_trace_done(); 
+extern void log_trace_init(char *);
+#endif 
 
 void
 releaseServerSockets(void)
@@ -338,9 +342,15 @@ sigusr2_handle(int sig)
     if (state == 0) {
        _db_init(Config.Log.log, "ALL,10");
        state = 1;
+#if MEM_GEN_TRACE
+       log_trace_done();
+#endif
     } else {
        _db_init(Config.Log.log, Config.debugOptions);
        state = 0;
+#if MEM_GEN_TRACE
+       log_trace_init("/tmp/squid.alloc");
+#endif
     }
 #if !HAVE_SIGACTION
     signal(sig, sigusr2_handle);       /* reinstall */