r4800 - trunk/varnish-cache/bin/varnishd
phk at varnish-cache.org
phk at varnish-cache.org
Mon May 17 12:11:15 CEST 2010
Author: phk
Date: 2010-05-17 12:11:15 +0200 (Mon, 17 May 2010)
New Revision: 4800
Modified:
trunk/varnish-cache/bin/varnishd/cache_panic.c
trunk/varnish-cache/bin/varnishd/cache_shmlog.c
trunk/varnish-cache/bin/varnishd/common.h
trunk/varnish-cache/bin/varnishd/mgt_child.c
Log:
Simplify the panic string processing
Modified: trunk/varnish-cache/bin/varnishd/cache_panic.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_panic.c 2010-05-17 09:58:26 UTC (rev 4799)
+++ trunk/varnish-cache/bin/varnishd/cache_panic.c 2010-05-17 10:11:15 UTC (rev 4800)
@@ -44,6 +44,7 @@
#include <execinfo.h>
#endif
#include "cache.h"
+#include "shmlog.h"
#include "cache_backend.h"
#include "vcl.h"
#include "libvcl.h"
@@ -57,7 +58,6 @@
* (gdb) printf "%s", panicstr
*/
-char panicstr[65536];
static struct vsb vsps, *vsp;
/*--------------------------------------------------------------------*/
@@ -294,7 +294,6 @@
pan_ic(const char *func, const char *file, int line, const char *cond,
int err, int xxx)
{
- int l;
char *p;
const char *q;
const struct sess *sp;
@@ -341,22 +340,19 @@
}
vsb_printf(vsp, "\n");
vsb_bcat(vsp, "", 1); /* NUL termination */
- VSL_Panic(&l, &p);
- if (l < sizeof(panicstr))
- l = sizeof(panicstr);
- memcpy(p, panicstr, l);
+
if (params->diag_bitmap & 0x4000)
- (void)fputs(panicstr, stderr);
+ (void)fputs(loghead->panicstr, stderr);
#ifdef HAVE_ABORT2
if (params->diag_bitmap & 0x8000) {
void *arg[1];
- for (p = panicstr; *p; p++)
+ for (p = loghead->panicstr; *p; p++)
if (*p == '\n')
*p = ' ';
- arg[0] = panicstr;
- abort2(panicstr, 1, arg);
+ arg[0] = loghead->panicstr;
+ abort2(loghead->panicstr, 1, arg);
}
#endif
if (params->diag_bitmap & 0x1000)
@@ -373,5 +369,6 @@
lbv_assert = pan_ic;
vsp = &vsps;
- AN(vsb_new(vsp, panicstr, sizeof panicstr, VSB_FIXEDLEN));
+ AN(vsb_new(vsp, loghead->panicstr, sizeof loghead->panicstr,
+ VSB_FIXEDLEN));
}
Modified: trunk/varnish-cache/bin/varnishd/cache_shmlog.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_shmlog.c 2010-05-17 09:58:26 UTC (rev 4799)
+++ trunk/varnish-cache/bin/varnishd/cache_shmlog.c 2010-05-17 10:11:15 UTC (rev 4800)
@@ -266,25 +266,6 @@
/*--------------------------------------------------------------------*/
void
-VSL_Panic(int *len, char **ptr)
-{
- static char a[1] = { '\0' };
-
- AN(len);
- AN(ptr);
- if (loghead->magic == SHMLOGHEAD_MAGIC) {
- assert(loghead->hdrsize == sizeof *loghead);
- *len = sizeof(loghead->panicstr);
- *ptr = loghead->panicstr;
- } else {
- *len = 0;
- *ptr = a;
- }
-}
-
-/*--------------------------------------------------------------------*/
-
-void
VSL_Init(void)
{
Modified: trunk/varnish-cache/bin/varnishd/common.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/common.h 2010-05-17 09:58:26 UTC (rev 4799)
+++ trunk/varnish-cache/bin/varnishd/common.h 2010-05-17 10:11:15 UTC (rev 4800)
@@ -38,9 +38,6 @@
/* cache_acceptor.c */
void VCA_tweak_waiter(struct cli *cli, const char *arg);
-/* shmlog.c */
-void VSL_Panic(int *len, char **ptr);
-
/* mgt_shmem.c */
extern struct varnish_stats *VSL_stats;
extern struct shmloghead *loghead;
Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_child.c 2010-05-17 09:58:26 UTC (rev 4799)
+++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2010-05-17 10:11:15 UTC (rev 4800)
@@ -59,6 +59,7 @@
#endif
#include "mgt.h"
+#include "shmlog.h"
#include "heritage.h"
#include "cli.h"
#include "cli_priv.h"
@@ -459,13 +460,11 @@
static void
mgt_report_panic(pid_t r)
{
- int l;
- char *p;
- VSL_Panic(&l, &p);
- if (*p == '\0')
+ if (loghead->panicstr[0] == '\0')
return;
- REPORT(LOG_ERR, "Child (%jd) Panic message: %s", (intmax_t)r, p);
+ REPORT(LOG_ERR, "Child (%jd) Panic message: %s",
+ (intmax_t)r, loghead->panicstr);
}
/*--------------------------------------------------------------------*/
More information about the varnish-commit
mailing list