r4812 - trunk/varnish-cache/bin/varnishd

phk at varnish-cache.org phk at varnish-cache.org
Tue May 18 14:05:25 CEST 2010


Author: phk
Date: 2010-05-18 14:05:25 +0200 (Tue, 18 May 2010)
New Revision: 4812

Modified:
   trunk/varnish-cache/bin/varnishd/stevedore.c
   trunk/varnish-cache/bin/varnishd/stevedore.h
   trunk/varnish-cache/bin/varnishd/varnishd.c
Log:
Add a stevedore call to complete initialization ("ready") which is called
as late as possible, before we start the child.



Modified: trunk/varnish-cache/bin/varnishd/stevedore.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/stevedore.c	2010-05-18 11:41:32 UTC (rev 4811)
+++ trunk/varnish-cache/bin/varnishd/stevedore.c	2010-05-18 12:05:25 UTC (rev 4812)
@@ -239,6 +239,18 @@
 }
 
 void
+STV_ready(void)
+{
+	struct stevedore *stv;
+
+	ASSERT_MGT();
+	VTAILQ_FOREACH(stv, &stevedores, list) {
+		if (stv->ready != NULL)
+			stv->ready(stv);
+	}
+}
+
+void
 STV_open(void)
 {
 	struct stevedore *stv;

Modified: trunk/varnish-cache/bin/varnishd/stevedore.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/stevedore.h	2010-05-18 11:41:32 UTC (rev 4811)
+++ trunk/varnish-cache/bin/varnishd/stevedore.h	2010-05-18 12:05:25 UTC (rev 4812)
@@ -36,6 +36,7 @@
 struct objcore;
 
 typedef void storage_init_f(struct stevedore *, int ac, char * const *av);
+typedef void storage_ready_f(struct stevedore *);
 typedef void storage_open_f(const struct stevedore *);
 typedef struct storage *storage_alloc_f(struct stevedore *, size_t size,
     struct objcore *);
@@ -50,6 +51,7 @@
 #define STEVEDORE_MAGIC		0x4baf43db
 	const char		*name;
 	storage_init_f		*init;	/* called by mgt process */
+	storage_ready_f		*ready;	/* called by mgt process */
 	storage_open_f		*open;	/* called by cache process */
 	storage_alloc_f		*alloc;
 	storage_trim_f		*trim;
@@ -71,6 +73,7 @@
 void STV_trim(struct storage *st, size_t size);
 void STV_free(struct storage *st);
 void STV_add(const struct stevedore *stv, int ac, char * const *av);
+void STV_ready(void);
 void STV_open(void);
 void STV_close(void);
 struct lru *STV_lru(const struct storage *st);

Modified: trunk/varnish-cache/bin/varnishd/varnishd.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/varnishd.c	2010-05-18 11:41:32 UTC (rev 4811)
+++ trunk/varnish-cache/bin/varnishd/varnishd.c	2010-05-18 12:05:25 UTC (rev 4812)
@@ -719,6 +719,8 @@
 		mgt_cli_telnet(tmpbuf);
 	}
 
+	STV_ready();	/* Complete initialization */
+
 	MGT_Run();
 
 	if (pfh != NULL)




More information about the varnish-commit mailing list