From: kostas <> Date: Fri, 27 Feb 1998 14:24:55 +0000 (+0000) Subject: USR2 is used to enable tracing X-Git-Tag: SQUID_3_0_PRE1~3958 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63986a8502fe0475c04dc558ac55a9f3b2fba7aa;p=thirdparty%2Fsquid.git USR2 is used to enable tracing --- diff --git a/lib/util.c b/lib/util.c index 2d1899cbcc..3095cac169 100644 --- a/lib/util.c +++ b/lib/util.c @@ -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); diff --git a/src/main.cc b/src/main.cc index 169d69ed6e..521b4699a1 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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) diff --git a/src/tools.cc b/src/tools.cc index 6cb4802fec..c94cbc4f90 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -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 */