[master] 86ecb84 Pass mgt_cls via the heritage structure.
Poul-Henning Kamp
phk at FreeBSD.org
Tue Sep 26 21:53:08 UTC 2017
commit 86ecb8429d59460cf1cfc74a62a74626f5310ec1
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Sep 26 21:31:49 2017 +0000
Pass mgt_cls via the heritage structure.
diff --git a/bin/varnishd/cache/cache_cli.c b/bin/varnishd/cache/cache_cli.c
index 905dee5..e7e5001 100644
--- a/bin/varnishd/cache/cache_cli.c
+++ b/bin/varnishd/cache/cache_cli.c
@@ -126,7 +126,7 @@ CLI_Init(void)
cls = VCLS_New(cli_cb_before, cli_cb_after,
&cache_param->cli_buffer, &cache_param->cli_limit);
AN(cls);
- VCLS_Clone(cls, mgt_cls);
+ VCLS_Clone(cls, heritage.cls);
CLI_AddFuncs(cli_cmds);
}
diff --git a/bin/varnishd/common/common.h b/bin/varnishd/common/common.h
index 3d5a3ae..78e6599 100644
--- a/bin/varnishd/common/common.h
+++ b/bin/varnishd/common/common.h
@@ -76,6 +76,3 @@ const struct transport *XPORT_Find(const char *name);
/* cache/cache_vcl.c */
int VCL_TestLoad(const char *);
-
-/* mgt_cli.c */
-extern struct VCLS *mgt_cls;
diff --git a/bin/varnishd/common/heritage.h b/bin/varnishd/common/heritage.h
index 95f6c3e..238c293 100644
--- a/bin/varnishd/common/heritage.h
+++ b/bin/varnishd/common/heritage.h
@@ -33,6 +33,7 @@ struct vsmw;
struct suckaddr;
struct listen_sock;
struct transport;
+struct VCLS;
struct listen_arg {
unsigned magic;
@@ -81,6 +82,8 @@ struct heritage {
char *panic_str;
ssize_t panic_str_len;
+
+ struct VCLS *cls;
};
extern struct heritage heritage;
diff --git a/bin/varnishd/mgt/mgt.h b/bin/varnishd/mgt/mgt.h
index b5b46a4..7594bd4 100644
--- a/bin/varnishd/mgt/mgt.h
+++ b/bin/varnishd/mgt/mgt.h
@@ -65,6 +65,7 @@ void MCH_TrackHighFd(int fd);
void MCH_Cli_Fail(void);
/* mgt_cli.c */
+extern struct VCLS *mgt_cls;
typedef void mgt_cli_close_f(void *priv);
void mgt_cli_setup(int fdi, int fdo, int auth, const char *ident,
diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index 38d0674..6aec3f4 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -338,7 +338,6 @@ mgt_launch_child(struct cli *cli)
}
if (pid == 0) {
-
/* Redirect stdin/out/err */
VFIL_null_fd(STDIN_FILENO);
assert(dup2(heritage.std_fd, STDOUT_FILENO) == STDOUT_FILENO);
@@ -363,7 +362,11 @@ mgt_launch_child(struct cli *cli)
if (close(i) == 0)
VFIL_null_fd(i);
}
+
mgt_ProcTitle("Child");
+
+ heritage.cls = mgt_cls;
+
if (mgt_param.sigsegv_handler) {
memset(&sa, 0, sizeof sa);
sa.sa_sigaction = child_signal_handler;
More information about the varnish-commit
mailing list