From: wessels <> Date: Tue, 19 Nov 1996 14:21:12 +0000 (+0000) Subject: Make pid_filename default X-Git-Tag: SQUID_3_0_PRE1~5444 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0b4639afb173d959e59361fb1fa18767a90c4ae1;p=thirdparty%2Fsquid.git Make pid_filename default stack trace #ifdefs --- diff --git a/src/Makefile.in b/src/Makefile.in index b8b7c5f133..318df62071 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.55 1996/11/12 22:36:59 wessels Exp $ +# $Id: Makefile.in,v 1.56 1996/11/19 07:21:12 wessels Exp $ # # Uncomment and customize the following to suit your needs: # @@ -32,6 +32,7 @@ DEFAULT_DNSSERVER = $(libexecdir)/dnsserver DEFAULT_CACHE_LOG = $(localstatedir)/logs/cache.log DEFAULT_ACCESS_LOG = $(localstatedir)/logs/access.log DEFAULT_STORE_LOG = $(localstatedir)/logs/store.log +DEFAULT_PID_FILE = $(localstatedir)/logs/squid.pid DEFAULT_SWAP_DIR = $(localstatedir)/cache DEFAULT_PINGER = $(libexecdir)/pinger @@ -115,6 +116,7 @@ DEFAULTS = \ -DDEFAULT_CACHE_LOG=\"$(DEFAULT_CACHE_LOG)\" \ -DDEFAULT_ACCESS_LOG=\"$(DEFAULT_ACCESS_LOG)\" \ -DDEFAULT_STORE_LOG=\"$(DEFAULT_STORE_LOG)\" \ + -DDEFAULT_PID_FILE=\"$(DEFAULT_PID_FILE)\" \ -DDEFAULT_SWAP_DIR=\"$(DEFAULT_SWAP_DIR)\" \ -DDEFAULT_PINGER=\"$(DEFAULT_PINGER)\" @@ -151,6 +153,7 @@ squid.conf: squid.conf.pre Makefile s%@DEFAULT_CACHE_LOG@%$(DEFAULT_CACHE_LOG)%g;\ s%@DEFAULT_ACCESS_LOG@%$(DEFAULT_ACCESS_LOG)%g;\ s%@DEFAULT_STORE_LOG@%$(DEFAULT_STORE_LOG)%g;\ + s%@DEFAULT_PID_FILE@%$(DEFAULT_PID_FILE)%g;\ s%@DEFAULT_SWAP_DIR@%$(DEFAULT_SWAP_DIR)%g" < squid.conf.pre >$@ install-mkdirs: diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 324c4cdbde..185a5ff820 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,5 +1,5 @@ /* - * $Id: cache_cf.cc,v 1.141 1996/11/18 18:22:01 wessels Exp $ + * $Id: cache_cf.cc,v 1.142 1996/11/19 07:21:13 wessels Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -174,7 +174,7 @@ struct SquidConfig Config; #define DefaultNeighborTimeout 2 /* 2 seconds */ #define DefaultStallDelay 1 /* 1 seconds */ #define DefaultSingleParentBypass 0 /* default off */ -#define DefaultPidFilename (char *)NULL /* default NONE */ +#define DefaultPidFilename DEFAULT_PID_FILE #define DefaultVisibleHostname (char *)NULL /* default NONE */ #define DefaultFtpUser "squid@" /* Default without domain */ #define DefaultAnnounceHost "sd.cache.nlanr.net" diff --git a/src/tools.cc b/src/tools.cc index 78c3a47c76..9987f293f5 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -1,6 +1,6 @@ /* - * $Id: tools.cc,v 1.83 1996/11/14 18:38:51 wessels Exp $ + * $Id: tools.cc,v 1.84 1996/11/19 07:21:15 wessels Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -240,6 +240,27 @@ death(int sig) fprintf(debug_log, "FATAL: Received Bus Error...dying.\n"); else fprintf(debug_log, "FATAL: Received signal %d...dying.\n", sig); + +#ifdef PRINT_STACK_TRACE +#ifdef _SQUID_HPUX_ + { + extern void U_STACK_TRACE(void); /* link with -lcl */ + fflush(debug_log); + dup2(fileno(debug_log), 2); + U_STACK_TRACE(); + } +#endif /* _SQUID_HPUX_ */ +#ifdef _SQUID_SOLARIS_ + { /* get ftp://opcom.sun.ca/pub/tars/opcom_stack.tar.gz and */ + extern void opcom_stack_trace(void); /* link with -lopcom_stack */ + fflush(debug_log); + dup2(fileno(debug_log), fileno(stdout)); + opcom_stack_trace(); + fflush(stdout); + } +#endif /* _SQUID_SOLARIS_ */ +#endif /* PRINT_STACK_TRACE */ + #if SA_RESETHAND == 0 signal(SIGSEGV, SIG_DFL); signal(SIGBUS, SIG_DFL); @@ -303,7 +324,7 @@ void normal_shutdown(void) { debug(21, 1, "Shutting down...\n"); - if (Config.pidFilename) { + if (Config.pidFilename && strcmp(Config.pidFilename, "none")) { enter_suid(); safeunlink(Config.pidFilename, 0); leave_suid(); @@ -506,9 +527,9 @@ void writePidFile(void) { FILE *pid_fp = NULL; - char *f = NULL; + const char *f = NULL; - if ((f = Config.pidFilename) == NULL) + if ((f = Config.pidFilename) == NULL || !strcmp(Config.pidFilename, "none")) return; enter_suid(); pid_fp = fopen(f, "w"); @@ -527,11 +548,11 @@ pid_t readPidFile(void) { FILE *pid_fp = NULL; - char *f = NULL; + const char *f = NULL; pid_t pid = -1; int i; - if ((f = Config.pidFilename) == NULL) { + if ((f = Config.pidFilename) == NULL || !strcmp(Config.pidFilename, "none")) { fprintf(stderr, "%s: ERROR: No pid file name defined\n", appname); exit(1); }