From: phk Date: Mon, 29 Oct 2007 09:28:21 +0000 (+0000) Subject: Give workspaces an identifying string to aid debugging. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14f06d707ad1819b3c805e656ee989b06f2e727b;p=varnish Give workspaces an identifying string to aid debugging. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2183 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index 6d5848b9..e2336942 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -90,6 +90,7 @@ enum step { */ 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 @@ void ESI_Destroy(struct object *); /* 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); diff --git a/varnish-cache/bin/varnishd/cache_backend.c b/varnish-cache/bin/varnishd/cache_backend.c index 1b2b9ca4..83da55c1 100644 --- a/varnish-cache/bin/varnishd/cache_backend.c +++ b/varnish-cache/bin/varnishd/cache_backend.c @@ -147,7 +147,7 @@ VBE_new_bereq(void) 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); diff --git a/varnish-cache/bin/varnishd/cache_fetch.c b/varnish-cache/bin/varnishd/cache_fetch.c index a3f1ea93..0f0b6f0a 100644 --- a/varnish-cache/bin/varnishd/cache_fetch.c +++ b/varnish-cache/bin/varnishd/cache_fetch.c @@ -278,7 +278,7 @@ Fetch(struct sess *sp) /* 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); diff --git a/varnish-cache/bin/varnishd/cache_session.c b/varnish-cache/bin/varnishd/cache_session.c index ca824017..463d3a03 100644 --- a/varnish-cache/bin/varnishd/cache_session.c +++ b/varnish-cache/bin/varnishd/cache_session.c @@ -318,7 +318,7 @@ SES_New(const struct sockaddr *addr, unsigned len) 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]; diff --git a/varnish-cache/bin/varnishd/cache_synthetic.c b/varnish-cache/bin/varnishd/cache_synthetic.c index ce6f8c19..b8c4c39c 100644 --- a/varnish-cache/bin/varnishd/cache_synthetic.c +++ b/varnish-cache/bin/varnishd/cache_synthetic.c @@ -73,7 +73,7 @@ SYN_ErrorPage(struct sess *sp, int status, const char *reason, int ttl) /* 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 @@ SYN_ErrorPage(struct sess *sp, int status, const char *reason, int ttl) /* allocate space for header */ - WS_Init(h->ws, malloc(1024), 1024); + WS_Init(h->ws, "error", malloc(1024), 1024); /* generate header */ http_ClrHeader(h); diff --git a/varnish-cache/bin/varnishd/cache_ws.c b/varnish-cache/bin/varnishd/cache_ws.c index f3a22c9e..2ef8bcee 100644 --- a/varnish-cache/bin/varnishd/cache_ws.c +++ b/varnish-cache/bin/varnishd/cache_ws.c @@ -57,8 +57,8 @@ WS_Assert(const struct ws *ws) { 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 @@ WS_Assert(const struct ws *ws) } 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); }