r3767 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Fri Feb 13 13:16:34 CET 2009


Author: phk
Date: 2009-02-13 13:16:34 +0100 (Fri, 13 Feb 2009)
New Revision: 3767

Modified:
   trunk/varnish-cache/bin/varnishd/cache_cli.c
   trunk/varnish-cache/bin/varnishd/mgt_cli.c
Log:
Add two hidden CLI commands for panic'ing the master and worker process.



Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_cli.c	2009-02-13 11:10:37 UTC (rev 3766)
+++ trunk/varnish-cache/bin/varnishd/cache_cli.c	2009-02-13 12:16:34 UTC (rev 3767)
@@ -223,6 +223,18 @@
 
 /*--------------------------------------------------------------------*/
 
+static void
+ccf_panic(struct cli *cli, const char * const *av, void *priv)
+{ 
+
+	(void)cli;
+	(void)av;
+	(void)priv;
+	assert(!strcmp("", "You asked for it"));
+}
+
+/*--------------------------------------------------------------------*/
+
 static struct cli_proto master_cmds[] = {
 	{ CLI_PING,		cli_func_ping },
 	{ CLI_HELP,             ccf_help, NULL },
@@ -233,6 +245,9 @@
 	{ "debug.sizeof", "debug.sizeof",
 		"\tDump sizeof various data structures\n",
 		0, 0, cli_debug_sizeof },
+	{ "debug.panic.worker", "debug.panic.worker",
+		"\tPanic the worker process.\n",
+		0, 0, ccf_panic },
 	{ NULL }
 };
 

Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_cli.c	2009-02-13 11:10:37 UTC (rev 3766)
+++ trunk/varnish-cache/bin/varnishd/mgt_cli.c	2009-02-13 12:16:34 UTC (rev 3767)
@@ -161,14 +161,29 @@
 	{ CLI_PARAM_SET,	mcf_param_set, NULL },
 
 	{ CLI_QUIT,		mcf_close, NULL},
-#if 0
-	{ CLI_SERVER_RESTART },
-	{ CLI_ZERO },
-	{ CLI_VERBOSE,		m_cli_func_verbose, NULL },
-#endif
 	{ NULL }
 };
 
+/*--------------------------------------------------------------------*/
+
+
+static void
+mcf_panic(struct cli *cli, const char * const *av, void *priv)
+{
+
+	(void)cli;
+	(void)av;
+	(void)priv;
+	assert(!strcmp("", "You asked for it"));
+}
+
+static struct cli_proto cli_debug[] = {
+	{ "debug.panic.master", "debug.panic.master",
+		"\tPanic the master process.\n",
+		0, 0, mcf_panic, NULL},
+	{ NULL }
+};
+
 /*--------------------------------------------------------------------
  * Ask the child something over CLI, return zero only if everything is
  * happy happy.
@@ -267,6 +282,8 @@
 		return (0);
 
 	cli_dispatch(cp->cli, cli_proto, p);
+	if (cp->cli->result == CLIS_UNKNOWN) 
+		cli_dispatch(cp->cli, cli_debug, p);
 	if (cp->cli->result == CLIS_UNKNOWN) {
 		/*
 		 * Command not recognized in master, try cacher if it is



More information about the varnish-commit mailing list