[master] 965f71621 Move handling of the start cli command to cache_main.c

Nils Goroll nils.goroll at uplex.de
Mon Sep 30 15:53:06 UTC 2024


commit 965f7162118fcc1011670146268672960597c305
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Thu Nov 1 15:24:41 2018 +0100

    Move handling of the start cli command to cache_main.c
    
    This was privously implemented in cache_acceptor.c. Move it to cache_main
    to be able to handle other tasks not only acceptor related during start.

diff --git a/bin/varnishd/cache/cache_acceptor.c b/bin/varnishd/cache/cache_acceptor.c
index 452a08c92..78dd7dc53 100644
--- a/bin/varnishd/cache/cache_acceptor.c
+++ b/bin/varnishd/cache/cache_acceptor.c
@@ -676,15 +676,11 @@ vca_acct(void *arg)
 
 /*--------------------------------------------------------------------*/
 
-static void v_matchproto_(cli_func_t)
-ccf_start(struct cli *cli, const char * const *av, void *priv)
+void
+VCA_Start(struct cli *cli)
 {
 	struct listen_sock *ls;
 
-	(void)cli;
-	(void)av;
-	(void)priv;
-
 	(void)vca_sock_opt_init();
 
 	VTAILQ_FOREACH(ls, &heritage.socks, list) {
@@ -752,7 +748,6 @@ ccf_listen_address(struct cli *cli, const char * const *av, void *priv)
 /*--------------------------------------------------------------------*/
 
 static struct cli_proto vca_cmds[] = {
-	{ CLICMD_SERVER_START,		"", ccf_start },
 	{ CLICMD_DEBUG_LISTEN_ADDRESS,	"d", ccf_listen_address },
 	{ NULL }
 };
diff --git a/bin/varnishd/cache/cache_main.c b/bin/varnishd/cache/cache_main.c
index 303bc5de0..284a58be6 100644
--- a/bin/varnishd/cache/cache_main.c
+++ b/bin/varnishd/cache/cache_main.c
@@ -366,6 +366,20 @@ cli_quit(int sig)
  * Run the child process
  */
 
+static void v_matchproto_(cli_func_t)
+ccf_child_start(struct cli *cli, const char * const *av, void *priv)
+{
+	(void)av;
+	(void)priv;
+
+	VCA_Start(cli);
+}
+
+static struct cli_proto child_cmds[] = {
+	{ CLICMD_SERVER_START,		"", ccf_child_start },
+	{ NULL }
+};
+
 void
 child_main(int sigmagic, size_t altstksz)
 {
@@ -443,6 +457,7 @@ child_main(int sigmagic, size_t altstksz)
 
 
 	CLI_AddFuncs(debug_cmds);
+	CLI_AddFuncs(child_cmds);
 
 #if WITH_PERSISTENT_STORAGE
 	/* Wait for persistent storage to load if asked to */
diff --git a/bin/varnishd/cache/cache_varnishd.h b/bin/varnishd/cache/cache_varnishd.h
index 7f876290a..73a10352e 100644
--- a/bin/varnishd/cache/cache_varnishd.h
+++ b/bin/varnishd/cache/cache_varnishd.h
@@ -158,6 +158,7 @@ struct vcf {
 
 /* cache_acceptor.c */
 void VCA_Init(void);
+void VCA_Start(struct cli *cli);
 void VCA_Shutdown(void);
 
 /* cache_backend.c */


More information about the varnish-commit mailing list