r3861 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Tue Mar 3 10:33:27 CET 2009
Author: phk
Date: 2009-03-03 10:33:27 +0100 (Tue, 03 Mar 2009)
New Revision: 3861
Modified:
trunk/varnish-cache/bin/varnishd/mgt.h
trunk/varnish-cache/bin/varnishd/mgt_child.c
trunk/varnish-cache/bin/varnishd/varnishd.c
Log:
Minor bit of cleanup: initialize CLI from main() instead of mgt_run().
Modified: trunk/varnish-cache/bin/varnishd/mgt.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt.h 2009-03-02 17:29:45 UTC (rev 3860)
+++ trunk/varnish-cache/bin/varnishd/mgt.h 2009-03-03 09:33:27 UTC (rev 3861)
@@ -37,11 +37,12 @@
struct cli;
extern struct vev_base *mgt_evb;
-extern unsigned d_flag;
+extern unsigned d_flag;
+extern pid_t mgt_pid;
/* mgt_child.c */
-void mgt_run(const char *T_arg);
-extern pid_t mgt_pid, child_pid;
+extern pid_t child_pid;
+void MGT_Run(void);
void mgt_stop_child(void);
/* mgt_cli.c */
Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_child.c 2009-03-02 17:29:45 UTC (rev 3860)
+++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2009-03-03 09:33:27 UTC (rev 3861)
@@ -64,7 +64,6 @@
#include "vss.h"
#include "vbm.h"
-pid_t mgt_pid;
pid_t child_pid = -1;
static struct vbitmap *fd_map;
@@ -89,7 +88,6 @@
[CH_DIED] = "died, (restarting)",
};
-struct vev_base *mgt_evb;
static struct vev *ev_poker;
static struct vev *ev_listen;
static struct vlu *vlu;
@@ -499,23 +497,12 @@
*/
void
-mgt_run(const char *T_arg)
+MGT_Run(void)
{
struct sigaction sac;
struct vev *e;
int i;
- mgt_pid = getpid();
-
- mgt_evb = vev_new_base();
- XXXAN(mgt_evb);
-
- if (d_flag)
- mgt_cli_setup(0, 1, 1, "debug");
-
- if (T_arg)
- mgt_cli_telnet(T_arg);
-
e = vev_new();
XXXAN(e);
e->sig = SIGTERM;
Modified: trunk/varnish-cache/bin/varnishd/varnishd.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/varnishd.c 2009-03-02 17:29:45 UTC (rev 3860)
+++ trunk/varnish-cache/bin/varnishd/varnishd.c 2009-03-03 09:33:27 UTC (rev 3861)
@@ -58,6 +58,7 @@
#endif
#include "vsb.h"
+#include "vev.h"
#include "vpf.h"
#include "vsha256.h"
@@ -76,10 +77,14 @@
#define INFTIM -1
#endif
-struct heritage heritage;
-volatile struct params *params;
-unsigned d_flag = 0;
+struct heritage heritage;
+volatile struct params *params;
+unsigned d_flag = 0;
+pid_t mgt_pid;
+struct vev_base *mgt_evb;
+
+
/*--------------------------------------------------------------------*/
static void *
@@ -605,8 +610,18 @@
if (pfh != NULL && vpf_write(pfh))
fprintf(stderr, "NOTE: Could not write PID file\n");
- mgt_run(T_arg);
+ mgt_pid = getpid();
+ mgt_evb = vev_new_base();
+ XXXAN(mgt_evb);
+
+ if (d_flag)
+ mgt_cli_setup(0, 1, 1, "debug");
+ if (T_arg)
+ mgt_cli_telnet(T_arg);
+
+ MGT_Run();
+
if (pfh != NULL)
(void)vpf_remove(pfh);
exit(0);
More information about the varnish-commit
mailing list