r3765 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Fri Feb 13 11:46:15 CET 2009
Author: phk
Date: 2009-02-13 11:46:14 +0100 (Fri, 13 Feb 2009)
New Revision: 3765
Modified:
trunk/varnish-cache/bin/varnishd/mgt.h
trunk/varnish-cache/bin/varnishd/mgt_child.c
trunk/varnish-cache/bin/varnishd/mgt_cli.c
trunk/varnish-cache/bin/varnishd/varnishd.c
Log:
Don't copy the debug flag around, make it a global instead.
Modified: trunk/varnish-cache/bin/varnishd/mgt.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt.h 2009-02-13 10:38:22 UTC (rev 3764)
+++ trunk/varnish-cache/bin/varnishd/mgt.h 2009-02-13 10:46:14 UTC (rev 3765)
@@ -37,9 +37,10 @@
struct cli;
extern struct vev_base *mgt_evb;
+extern unsigned d_flag;
/* mgt_child.c */
-void mgt_run(int dflag, const char *T_arg);
+void mgt_run(const char *T_arg);
extern pid_t mgt_pid, child_pid;
void mgt_stop_child(void);
@@ -49,7 +50,7 @@
int mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...);
void mgt_cli_start_child(int fdi, int fdo);
void mgt_cli_stop_child(void);
-void mgt_cli_telnet(int dflag, const char *T_arg);
+void mgt_cli_telnet(const char *T_arg);
/* mgt_param.c */
void MCF_ParamSync(void);
Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_child.c 2009-02-13 10:38:22 UTC (rev 3764)
+++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2009-02-13 10:46:14 UTC (rev 3765)
@@ -499,7 +499,7 @@
*/
void
-mgt_run(int dflag, const char *T_arg)
+mgt_run(const char *T_arg)
{
struct sigaction sac;
struct vev *e;
@@ -510,11 +510,11 @@
mgt_evb = vev_new_base();
XXXAN(mgt_evb);
- if (dflag)
+ if (d_flag)
mgt_cli_setup(0, 1, 1, "debug");
if (T_arg)
- mgt_cli_telnet(dflag, T_arg);
+ mgt_cli_telnet(T_arg);
e = vev_new();
XXXAN(e);
@@ -547,9 +547,9 @@
AZ(sigaction(SIGPIPE, &sac, NULL));
AZ(sigaction(SIGHUP, &sac, NULL));
- if (!dflag && !mgt_has_vcl())
+ if (!d_flag && !mgt_has_vcl())
REPORT0(LOG_ERR, "No VCL loaded yet");
- else if (!dflag) {
+ else if (!d_flag) {
start_child(NULL);
if (child_state == CH_STOPPED)
exit(2);
Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2009-02-13 10:38:22 UTC (rev 3764)
+++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2009-02-13 10:46:14 UTC (rev 3765)
@@ -74,8 +74,6 @@
static void telnet_close_all(void);
static void telnet_close_one(int fd);
-static int dflag_copy;
-
/*--------------------------------------------------------------------*/
static void
@@ -335,7 +333,7 @@
(void)close(2);
assert(open("/dev/null", O_WRONLY) == 2);
- if (dflag_copy == 2) {
+ if (d_flag == 2) {
mgt_stop_child();
telnet_close_all();
}
@@ -475,15 +473,13 @@
}
void
-mgt_cli_telnet(int dflag, const char *T_arg)
+mgt_cli_telnet(const char *T_arg)
{
struct vss_addr **ta;
char *addr, *port;
int i, n, sock, good;
struct telnet *tn;
- dflag_copy = dflag;
-
XXXAZ(VSS_parse(T_arg, &addr, &port));
n = VSS_resolve(addr, port, &ta);
if (n == 0) {
Modified: trunk/varnish-cache/bin/varnishd/varnishd.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/varnishd.c 2009-02-13 10:38:22 UTC (rev 3764)
+++ trunk/varnish-cache/bin/varnishd/varnishd.c 2009-02-13 10:46:14 UTC (rev 3765)
@@ -78,6 +78,7 @@
struct heritage heritage;
volatile struct params *params;
+unsigned d_flag = 0;
/*--------------------------------------------------------------------*/
@@ -420,7 +421,6 @@
{
int o;
unsigned C_flag = 0;
- unsigned d_flag = 0;
unsigned F_flag = 0;
const char *b_arg = NULL;
const char *f_arg = NULL;
@@ -636,7 +636,7 @@
if (pfh != NULL && vpf_write(pfh))
fprintf(stderr, "NOTE: Could not write PID file\n");
- mgt_run(d_flag, T_arg);
+ mgt_run(T_arg);
if (pfh != NULL)
(void)vpf_remove(pfh);
More information about the varnish-commit
mailing list