r3888 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Thu Mar 5 23:27:44 CET 2009
Author: phk
Date: 2009-03-05 23:27:43 +0100 (Thu, 05 Mar 2009)
New Revision: 3888
Modified:
trunk/varnish-cache/bin/varnishd/mgt.h
trunk/varnish-cache/bin/varnishd/mgt_child.c
trunk/varnish-cache/bin/varnishd/varnishd.c
Log:
Keep track of worker processes that have died of unatural causes
and exit the manager with a bitmap that tells what we saw underway.
Modified: trunk/varnish-cache/bin/varnishd/mgt.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt.h 2009-03-05 22:13:26 UTC (rev 3887)
+++ trunk/varnish-cache/bin/varnishd/mgt.h 2009-03-05 22:27:43 UTC (rev 3888)
@@ -39,6 +39,7 @@
extern struct vev_base *mgt_evb;
extern unsigned d_flag;
extern pid_t mgt_pid;
+extern int exit_status;
/* mgt_child.c */
extern pid_t child_pid;
Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_child.c 2009-03-05 22:13:26 UTC (rev 3887)
+++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2009-03-05 22:27:43 UTC (rev 3888)
@@ -431,13 +431,19 @@
vsb = vsb_newauto();
XXXAN(vsb);
vsb_printf(vsb, "Child (%d) %s", r, status ? "died" : "ended");
- if (!WIFEXITED(status) && WEXITSTATUS(status))
+ if (!WIFEXITED(status) && WEXITSTATUS(status)) {
vsb_printf(vsb, " status=%d", WEXITSTATUS(status));
- if (WIFSIGNALED(status))
+ exit_status |= 0x20;
+ }
+ if (WIFSIGNALED(status)) {
vsb_printf(vsb, " signal=%d", WTERMSIG(status));
+ exit_status |= 0x40;
+ }
#ifdef WCOREDUMP
- if (WCOREDUMP(status))
+ if (WCOREDUMP(status)) {
vsb_printf(vsb, " (core dumped)");
+ exit_status |= 0x80;
+ }
#endif
vsb_finish(vsb);
AZ(vsb_overflowed(vsb));
@@ -547,7 +553,6 @@
REPORT(LOG_ERR, "vev_schedule() = %d", i);
REPORT0(LOG_ERR, "manager dies");
- exit(2);
}
/*--------------------------------------------------------------------*/
Modified: trunk/varnish-cache/bin/varnishd/varnishd.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/varnishd.c 2009-03-05 22:13:26 UTC (rev 3887)
+++ trunk/varnish-cache/bin/varnishd/varnishd.c 2009-03-05 22:27:43 UTC (rev 3888)
@@ -82,9 +82,8 @@
unsigned d_flag = 0;
pid_t mgt_pid;
struct vev_base *mgt_evb;
+int exit_status;
-
-
/*--------------------------------------------------------------------*/
static void *
@@ -632,5 +631,5 @@
if (pfh != NULL)
(void)vpf_remove(pfh);
- exit(0);
+ exit(exit_status);
}
More information about the varnish-commit
mailing list