[master] 917566c Pass a (dummy) handler argument into waiter-instantiation
Poul-Henning Kamp
phk at FreeBSD.org
Mon Jan 12 10:52:08 CET 2015
commit 917566c170694aa015b9dda6d58de28c52899ddb
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Jan 12 09:28:15 2015 +0000
Pass a (dummy) handler argument into waiter-instantiation
diff --git a/bin/varnishd/cache/cache_main.c b/bin/varnishd/cache/cache_main.c
index 880f7cf..67e02ee 100644
--- a/bin/varnishd/cache/cache_main.c
+++ b/bin/varnishd/cache/cache_main.c
@@ -211,7 +211,7 @@ child_main(void)
Lck_New(&vxid_lock, lck_vxid);
- WAIT_Init();
+ WAIT_Init(NULL);
PAN_Init();
CLI_Init();
VFP_Init();
diff --git a/bin/varnishd/waiter/cache_waiter.c b/bin/varnishd/waiter/cache_waiter.c
index 2ed1904..ca32433 100644
--- a/bin/varnishd/waiter/cache_waiter.c
+++ b/bin/varnishd/waiter/cache_waiter.c
@@ -51,14 +51,14 @@ WAIT_GetName(void)
}
void
-WAIT_Init(void)
+WAIT_Init(waiter_handle_f *func)
{
AN(waiter);
AN(waiter->name);
AN(waiter->init);
AN(waiter->pass);
- waiter_priv = waiter->init();
+ waiter_priv = waiter->init(func);
}
int
diff --git a/bin/varnishd/waiter/cache_waiter_epoll.c b/bin/varnishd/waiter/cache_waiter_epoll.c
index b907bbe..28d113d 100644
--- a/bin/varnishd/waiter/cache_waiter_epoll.c
+++ b/bin/varnishd/waiter/cache_waiter_epoll.c
@@ -232,10 +232,11 @@ vwe_pass(void *priv, struct sess *sp)
/*--------------------------------------------------------------------*/
static void *
-vwe_init(void)
+vwe_init(waiter_handle_f *func)
{
struct vwe *vwe;
+ (void)func;
ALLOC_OBJ(vwe, VWE_MAGIC);
AN(vwe);
VTAILQ_INIT(&vwe->sesshead);
diff --git a/bin/varnishd/waiter/cache_waiter_kqueue.c b/bin/varnishd/waiter/cache_waiter_kqueue.c
index 86efe68..4214eb9 100644
--- a/bin/varnishd/waiter/cache_waiter_kqueue.c
+++ b/bin/varnishd/waiter/cache_waiter_kqueue.c
@@ -228,10 +228,11 @@ vwk_pass(void *priv, struct sess *sp)
/*--------------------------------------------------------------------*/
static void *
-vwk_init(void)
+vwk_init(waiter_handle_f *func)
{
struct vwk *vwk;
+ (void)func;
ALLOC_OBJ(vwk, VWK_MAGIC);
AN(vwk);
diff --git a/bin/varnishd/waiter/cache_waiter_poll.c b/bin/varnishd/waiter/cache_waiter_poll.c
index dbec205..96f37cd 100644
--- a/bin/varnishd/waiter/cache_waiter_poll.c
+++ b/bin/varnishd/waiter/cache_waiter_poll.c
@@ -205,10 +205,11 @@ vwp_poll_pass(void *priv, struct sess *sp)
/*--------------------------------------------------------------------*/
static void *
-vwp_poll_init(void)
+vwp_poll_init(waiter_handle_f *func)
{
struct vwp *vwp;
+ (void)func;
ALLOC_OBJ(vwp, VWP_MAGIC);
AN(vwp);
VTAILQ_INIT(&vwp->sesshead);
diff --git a/bin/varnishd/waiter/cache_waiter_ports.c b/bin/varnishd/waiter/cache_waiter_ports.c
index 2cede4b..fd397ac 100644
--- a/bin/varnishd/waiter/cache_waiter_ports.c
+++ b/bin/varnishd/waiter/cache_waiter_ports.c
@@ -256,10 +256,11 @@ vws_pass(void *priv, struct sess *sp)
/*--------------------------------------------------------------------*/
static void *
-vws_init(void)
+vws_init(waiter_handle_f *func)
{
struct vws *vws;
+ (void)func
ALLOC_OBJ(vws, VWS_MAGIC);
AN(vws);
VTAILQ_INIT(&vws->sesshead);
diff --git a/bin/varnishd/waiter/waiter.h b/bin/varnishd/waiter/waiter.h
index 4e2e079..d01b4fd 100644
--- a/bin/varnishd/waiter/waiter.h
+++ b/bin/varnishd/waiter/waiter.h
@@ -30,7 +30,14 @@
struct sess;
-typedef void* waiter_init_f(void);
+enum wait_event {
+ WAITER_REMCLOSE,
+ WAITER_TIMEOUT,
+ WAITER_ACTION
+};
+
+typedef void waiter_handle_f(void *ptr, int fd, enum wait_event);
+typedef void* waiter_init_f(waiter_handle_f *);
typedef int waiter_pass_f(void *priv, struct sess *);
#define WAITER_DEFAULT "platform dependent"
@@ -43,7 +50,7 @@ struct waiter {
/* cache_waiter.c */
int WAIT_Enter(struct sess *sp);
-void WAIT_Init(void);
+void WAIT_Init(waiter_handle_f *);
const char *WAIT_GetName(void);
int WAIT_Write_Session(struct sess *sp, int fd);
More information about the varnish-commit
mailing list