]> err.no Git - varnish/commitdiff
Give 'exit' CLI command some bite. we may want to be more careful
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 11 Jul 2006 18:16:13 +0000 (18:16 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 11 Jul 2006 18:16:13 +0000 (18:16 +0000)
later on.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@437 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/mgt.h
varnish-cache/bin/varnishd/mgt_child.c
varnish-cache/bin/varnishd/varnishd.c

index 263c55819d4e7cdf3a0251ef33f47575e4cb67c9..b3488049a8dec0c39842b4ca4a5f9053227ddf99 100644 (file)
@@ -8,6 +8,7 @@ extern struct event_base *mgt_eb;
 
 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 *);
index aa84bb2a4760d92eac5df08a44b25800bfb5aee7..410c45276f993551e178cfc22f32ae49d0375f1e 100644 (file)
@@ -282,6 +282,16 @@ mgt_child_stop(void)
 
 /*--------------------------------------------------------------------*/
 
+void
+mgt_child_kill(void)
+{
+
+       desired = H_STOP;
+       kill(child_pid, 9);
+}
+
+/*--------------------------------------------------------------------*/
+
 void
 mgt_sigchld(int a, short b, void *c)
 {
index 4d15519aed814e63cb3863641afa42da20785e69..d732126755edb9830c4476dc7c4391951669cfe1 100644 (file)
@@ -239,6 +239,16 @@ m_cli_func_server_stop(struct cli *cli, char **av, void *priv)
 
 /*--------------------------------------------------------------------*/
 
+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 @@ static struct cli_proto cli_proto[] = {
        { 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 }