[master] d835dfc Make mgt_child register its own CLI commands
Poul-Henning Kamp
phk at FreeBSD.org
Sun May 22 01:06:05 CEST 2016
commit d835dfc51b9924a68c6ae984e618ee9c39eb8ffa
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Sat May 21 22:26:36 2016 +0000
Make mgt_child register its own CLI commands
diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index 3aee527..0c6482f 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -49,6 +49,7 @@
#include "vbm.h"
#include "vcli.h"
#include "vcli_priv.h"
+#include "vcli_serve.h"
#include "vev.h"
#include "vlu.h"
#include "vtim.h"
@@ -130,7 +131,7 @@ mgt_panic_clear(void)
VSB_destroy(&child_panic);
}
-void __match_proto__(cli_func_t)
+static void __match_proto__(cli_func_t)
mcf_panic_show(struct cli *cli, const char * const *av, void *priv)
{
(void)av;
@@ -146,7 +147,7 @@ mcf_panic_show(struct cli *cli, const char * const *av, void *priv)
VCLI_Out(cli, "%s\n", VSB_data(child_panic));
}
-void __match_proto__(cli_func_t)
+static void __match_proto__(cli_func_t)
mcf_panic_clear(struct cli *cli, const char * const *av, void *priv)
{
(void)priv;
@@ -616,7 +617,7 @@ mgt_stop_child(void)
* CLI commands to start/stop child
*/
-void __match_proto__(cli_func_t)
+static void __match_proto__(cli_func_t)
mcf_server_start(struct cli *cli, const char * const *av, void *priv)
{
@@ -635,7 +636,7 @@ mcf_server_start(struct cli *cli, const char * const *av, void *priv)
}
}
-void __match_proto__(cli_func_t)
+static void __match_proto__(cli_func_t)
mcf_server_stop(struct cli *cli, const char * const *av, void *priv)
{
@@ -651,7 +652,7 @@ mcf_server_stop(struct cli *cli, const char * const *av, void *priv)
/*--------------------------------------------------------------------*/
-void
+static void
mcf_server_status(struct cli *cli, const char * const *av, void *priv)
{
(void)av;
@@ -690,6 +691,17 @@ mgt_uptime(const struct vev *e, int what)
return (0);
}
+/*--------------------------------------------------------------------*/
+
+static struct cli_proto cli_child[] = {
+ { CLICMD_SERVER_STATUS, "", mcf_server_status },
+ { CLICMD_SERVER_START, "", mcf_server_start },
+ { CLICMD_SERVER_STOP, "", mcf_server_stop },
+ { CLICMD_PANIC_SHOW, "", mcf_panic_show },
+ { CLICMD_PANIC_CLEAR, "", mcf_panic_clear },
+ { NULL }
+};
+
/*=====================================================================
* This thread is the master thread in the management process.
* The relatively simple task is to start and stop the child process
@@ -703,6 +715,8 @@ MGT_Run(void)
struct vev *e;
int i;
+ VCLS_AddFunc(mgt_cls, 0, cli_child);
+
mgt_uptime_t0 = VTIM_real();
e = vev_new();
XXXAN(e);
diff --git a/bin/varnishd/mgt/mgt_cli.c b/bin/varnishd/mgt/mgt_cli.c
index 26a7a50..7e7a0af 100644
--- a/bin/varnishd/mgt/mgt_cli.c
+++ b/bin/varnishd/mgt/mgt_cli.c
@@ -102,13 +102,8 @@ mcf_banner(struct cli *cli, const char *const *av, void *priv)
static struct cli_proto cli_proto[] = {
{ CLICMD_BANNER, "", mcf_banner },
- { CLICMD_SERVER_STATUS, "", mcf_server_status },
- { CLICMD_SERVER_START, "", mcf_server_start },
- { CLICMD_SERVER_STOP, "", mcf_server_stop },
{ CLICMD_PARAM_SHOW, "", mcf_param_show },
{ CLICMD_PARAM_SET, "", mcf_param_set },
- { CLICMD_PANIC_SHOW, "", mcf_panic_show },
- { CLICMD_PANIC_CLEAR, "", mcf_panic_clear },
{ NULL }
};
diff --git a/bin/varnishd/mgt/mgt_cli.h b/bin/varnishd/mgt/mgt_cli.h
index 8757c2c..5d57817 100644
--- a/bin/varnishd/mgt/mgt_cli.h
+++ b/bin/varnishd/mgt/mgt_cli.h
@@ -28,13 +28,6 @@
*
*/
-/* mgt_child.c */
-cli_func_t mcf_server_start;
-cli_func_t mcf_server_stop;
-cli_func_t mcf_server_status;
-cli_func_t mcf_panic_show;
-cli_func_t mcf_panic_clear;
-
/* mgt_param.c */
cli_func_t mcf_param_show;
cli_func_t mcf_param_set;
More information about the varnish-commit
mailing list