r2183 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Mon Oct 29 10:28:21 CET 2007


Author: phk
Date: 2007-10-29 10:28:21 +0100 (Mon, 29 Oct 2007)
New Revision: 2183

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_backend.c
   trunk/varnish-cache/bin/varnishd/cache_fetch.c
   trunk/varnish-cache/bin/varnishd/cache_session.c
   trunk/varnish-cache/bin/varnishd/cache_synthetic.c
   trunk/varnish-cache/bin/varnishd/cache_ws.c
Log:
Give workspaces an identifying string to aid debugging.


Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2007-10-29 09:24:16 UTC (rev 2182)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2007-10-29 09:28:21 UTC (rev 2183)
@@ -90,6 +90,7 @@
  */
 
 struct ws {
+	const char		*id;		/* identity */
 	char			*s;		/* (S)tart of buffer */
 	char			*f;		/* (F)ree pointer */
 	char			*r;		/* (R)eserved length */
@@ -584,7 +585,7 @@
 
 /* cache_ws.c */
 
-void WS_Init(struct ws *ws, void *space, unsigned len);
+void WS_Init(struct ws *ws, const char *id, void *space, unsigned len);
 unsigned WS_Reserve(struct ws *ws, unsigned bytes);
 void WS_Release(struct ws *ws, unsigned bytes);
 void WS_ReleaseP(struct ws *ws, char *ptr);

Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend.c	2007-10-29 09:24:16 UTC (rev 2182)
+++ trunk/varnish-cache/bin/varnishd/cache_backend.c	2007-10-29 09:28:21 UTC (rev 2183)
@@ -147,7 +147,7 @@
 		if (bereq == NULL)
 			return (NULL);
 		bereq->magic = BEREQ_MAGIC;
-		WS_Init(bereq->ws, bereq + 1, len);
+		WS_Init(bereq->ws, "bereq", bereq + 1, len);
 	}
 	http_Setup(bereq->http, bereq->ws);
 	return (bereq);

Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c	2007-10-29 09:24:16 UTC (rev 2182)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c	2007-10-29 09:28:21 UTC (rev 2183)
@@ -278,7 +278,7 @@
 
 	/* Set up obj's workspace */
 	st = sp->obj->objstore;
-	WS_Init(sp->obj->ws_o, st->ptr + st->len, st->space - st->len);
+	WS_Init(sp->obj->ws_o, "obj", st->ptr + st->len, st->space - st->len);
 	st->len = st->space;
 	WS_Assert(sp->obj->ws_o);
 	http_Setup(sp->obj->http, sp->obj->ws_o);

Modified: trunk/varnish-cache/bin/varnishd/cache_session.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_session.c	2007-10-29 09:24:16 UTC (rev 2182)
+++ trunk/varnish-cache/bin/varnishd/cache_session.c	2007-10-29 09:28:21 UTC (rev 2183)
@@ -318,7 +318,7 @@
 		sp->sockaddrlen = len;
 	}
 
-	WS_Init(sp->ws, (void *)(sm + 1), sm->workspace);
+	WS_Init(sp->ws, "sess", (void *)(sm + 1), sm->workspace);
 	sp->http = &sm->http[0];
 	sp->http0 = &sm->http[1];
 

Modified: trunk/varnish-cache/bin/varnishd/cache_synthetic.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_synthetic.c	2007-10-29 09:24:16 UTC (rev 2182)
+++ trunk/varnish-cache/bin/varnishd/cache_synthetic.c	2007-10-29 09:28:21 UTC (rev 2183)
@@ -73,7 +73,7 @@
 
 	/* Set up obj's workspace */
 	st = o->objstore;
-	WS_Init(o->ws_o, st->ptr + st->len, st->space - st->len);
+	WS_Init(o->ws_o, "obj", st->ptr + st->len, st->space - st->len);
 	st->len = st->space;
 	WS_Assert(o->ws_o);
 	http_Setup(o->http, o->ws_o);
@@ -126,7 +126,7 @@
 
 	/* allocate space for header */
 
-	WS_Init(h->ws, malloc(1024), 1024);
+	WS_Init(h->ws, "error", malloc(1024), 1024);
 
 	/* generate header */
 	http_ClrHeader(h);

Modified: trunk/varnish-cache/bin/varnishd/cache_ws.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_ws.c	2007-10-29 09:24:16 UTC (rev 2182)
+++ trunk/varnish-cache/bin/varnishd/cache_ws.c	2007-10-29 09:28:21 UTC (rev 2183)
@@ -57,8 +57,8 @@
 {
 
 	assert(ws != NULL);
-	WS_DEBUG((SLT_Debug, 0, "WS(%p = (%p %u %u %u)",
-	    ws, ws->s, pdiff(ws->s, ws->f),
+	WS_DEBUG((SLT_Debug, 0, "WS(%p = (%s, %p %u %u %u)",
+	    ws, ws->id, ws->s, pdiff(ws->s, ws->f),
 	    ws->r == NULL ? 0 : pdiff(ws->f, ws->r),
 	    pdiff(ws->s, ws->e)));
 	assert(ws->s != NULL);
@@ -73,15 +73,16 @@
 }
 
 void
-WS_Init(struct ws *ws, void *space, unsigned len)
+WS_Init(struct ws *ws, const char *id, void *space, unsigned len)
 {
 
-	WS_DEBUG((SLT_Debug, 0, "WS_Init(%p, %p, %u)", ws, space, len));
+	WS_DEBUG((SLT_Debug, 0, "WS_Init(%p, \"%s\", %p, %u)", ws, id, space, len));
 	assert(space != NULL);
 	memset(ws, 0, sizeof *ws);
 	ws->s = space;
 	ws->e = ws->s + len;
 	ws->f = ws->s;
+	ws->id = id;
 	WS_Assert(ws);
 }
 




More information about the varnish-commit mailing list