r437 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Tue Jul 11 20:16:14 CEST 2006


Author: phk
Date: 2006-07-11 20:16:13 +0200 (Tue, 11 Jul 2006)
New Revision: 437

Modified:
   trunk/varnish-cache/bin/varnishd/mgt.h
   trunk/varnish-cache/bin/varnishd/mgt_child.c
   trunk/varnish-cache/bin/varnishd/varnishd.c
Log:
Give 'exit' CLI command some bite.  we may want to be more careful
later on.


Modified: trunk/varnish-cache/bin/varnishd/mgt.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt.h	2006-07-11 17:53:44 UTC (rev 436)
+++ trunk/varnish-cache/bin/varnishd/mgt.h	2006-07-11 18:16:13 UTC (rev 437)
@@ -8,6 +8,7 @@
 
 void mgt_child_start(void);
 void mgt_child_stop(void);
+void mgt_child_kill(void);
 void mgt_sigchld(int, short, void *);
 
 typedef void mgt_ccb_f(unsigned, const char *, void *);

Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_child.c	2006-07-11 17:53:44 UTC (rev 436)
+++ trunk/varnish-cache/bin/varnishd/mgt_child.c	2006-07-11 18:16:13 UTC (rev 437)
@@ -283,6 +283,16 @@
 /*--------------------------------------------------------------------*/
 
 void
+mgt_child_kill(void)
+{
+
+	desired = H_STOP;
+	kill(child_pid, 9);
+}
+
+/*--------------------------------------------------------------------*/
+
+void
 mgt_sigchld(int a, short b, void *c)
 {
 	pid_t p;

Modified: trunk/varnish-cache/bin/varnishd/varnishd.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/varnishd.c	2006-07-11 17:53:44 UTC (rev 436)
+++ trunk/varnish-cache/bin/varnishd/varnishd.c	2006-07-11 18:16:13 UTC (rev 437)
@@ -240,6 +240,16 @@
 /*--------------------------------------------------------------------*/
 
 static void
+m_cli_func_exit(struct cli *cli, char **av, void *priv)
+{
+
+	mgt_child_kill();
+	exit (0);
+}
+
+/*--------------------------------------------------------------------*/
+
+static void
 m_cli_func_verbose(struct cli *cli, char **av, void *priv)
 {
 
@@ -304,7 +314,7 @@
 	{ CLI_ZERO },
 	{ CLI_HELP,		cli_func_help, cli_proto },
 	{ CLI_VERBOSE,		m_cli_func_verbose, NULL },
-	{ CLI_EXIT },
+	{ CLI_EXIT, 		m_cli_func_exit, NULL},
 	{ CLI_QUIT },
 	{ CLI_BYE },
 	{ NULL }




More information about the varnish-commit mailing list