From des at projects.linpro.no Mon Mar 3 10:53:31 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 3 Mar 2008 11:53:31 +0100 (CET) Subject: r2545 - in branches/1.1: . bin/varnishd Message-ID: <20080303105331.4EBE91EC0B7@projects.linpro.no> Author: des Date: 2008-03-03 11:53:31 +0100 (Mon, 03 Mar 2008) New Revision: 2545 Modified: branches/1.1/ branches/1.1/bin/varnishd/cache_fetch.c Log: Merged revisions 2091 via svnmerge from svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache ........ r2091 | phk | 2007-10-08 15:20:57 +0200 (Mon, 08 Oct 2007) | 4 lines EOF transfers are not limited to pre HTTP/1.1 backends, no idea why I thought so previously. ........ Property changes on: branches/1.1 ___________________________________________________________________ Name: svnmerge-integrated - /trunk/varnish-cache:1-1722,1727-1729,1733,1738,1743-1777,1779-1798,1800-1815,1817,1819,1823,1830-1838,1846,1853-1855,1857-1859,1862,1865-1868,1871-1880,1883-1884,1886,1888-1889,1896,1898,1902-1905,1907,1909,1912-1916,1920-1928,1935-1939,1941-1949,1955,1957-1958,1967-1968,1970-1974,1976-1977,1984,1986-1989,1991-1998,2026,2031-2033,2057,2077-2080,2086,2088,2097,2106-2107,2116,2133,2154,2173,2181,2206-2207,2211-2212,2215-2245,2256-2262,2270-2271,2275,2285-2286,2288-2291,2295-2301,2304-2327,2357-2359,2361-2364,2366,2374-2381,2383-2386,2414-2415,2421-2422,2426,2432-2434,2444-2445,2447,2457,2492-2494,2500-2502,2520-2521 + /trunk/varnish-cache:1-1722,1727-1729,1733,1738,1743-1777,1779-1798,1800-1815,1817,1819,1823,1830-1838,1846,1853-1855,1857-1859,1862,1865-1868,1871-1880,1883-1884,1886,1888-1889,1896,1898,1902-1905,1907,1909,1912-1916,1920-1928,1935-1939,1941-1949,1955,1957-1958,1967-1968,1970-1974,1976-1977,1984,1986-1989,1991-1998,2026,2031-2033,2057,2077-2080,2086,2088,2091,2097,2106-2107,2116,2133,2154,2173,2181,2206-2207,2211-2212,2215-2245,2256-2262,2270-2271,2275,2285-2286,2288-2291,2295-2301,2304-2327,2357-2359,2361-2364,2366,2374-2381,2383-2386,2414-2415,2421-2422,2426,2432-2434,2444-2445,2447,2457,2492-2494,2500-2502,2520-2521 Modified: branches/1.1/bin/varnishd/cache_fetch.c =================================================================== --- branches/1.1/bin/varnishd/cache_fetch.c 2008-02-29 09:38:49 UTC (rev 2544) +++ branches/1.1/bin/varnishd/cache_fetch.c 2008-03-03 10:53:31 UTC (rev 2545) @@ -343,7 +343,7 @@ VSL(SLT_Debug, vc->fd, "Invalid Transfer-Encoding"); VBE_ClosedFd(sp->wrk, vc); return (-1); - } else if (strcmp(http_GetProto(hp), "HTTP/1.1")) { + } else { switch (http_GetStatus(hp)) { case 200: cls = fetch_eof(sp, vc->fd, hp); From des at projects.linpro.no Mon Mar 3 17:03:05 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 3 Mar 2008 18:03:05 +0100 (CET) Subject: r2546 - in trunk/varnish-cache: bin/varnishd include Message-ID: <20080303170305.E07621EC1D1@projects.linpro.no> Author: des Date: 2008-03-03 18:03:05 +0100 (Mon, 03 Mar 2008) New Revision: 2546 Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c trunk/varnish-cache/include/vrt.h Log: Clean up the int -> str and ip -> str conversion code, and add double -> str. Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2008-03-03 10:53:31 UTC (rev 2545) +++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2008-03-03 17:03:05 UTC (rev 2546) @@ -37,6 +37,7 @@ #include #include +#include #include #include @@ -556,42 +557,53 @@ char * VRT_IP_string(const struct sess *sp, const struct sockaddr *sa) { - char h[64], p[8], *q; - socklen_t len = 0; + char *p; + const void *addr; + int len; - /* XXX can't rely on sockaddr.sa_len */ switch (sa->sa_family) { case AF_INET: - len = sizeof(struct sockaddr_in); + len = INET_ADDRSTRLEN; + addr = &((const struct sockaddr_in *)sa)->sin_addr; break; case AF_INET6: - len = sizeof(struct sockaddr_in6); + len = INET_ADDRSTRLEN; + addr = &((const struct sockaddr_in6 *)sa)->sin6_addr; break; default: INCOMPL(); } XXXAN(len); - TCP_name(sa, len, h, sizeof h, p, sizeof p); - q = WS_Alloc(sp->http->ws, strlen(h) + strlen(p) + 2); - AN(q); - strcpy(q, h); - strcat(q, ":"); - strcat(q, p); - return (q); + AN(p = WS_Alloc(sp->http->ws, len)); + AN(inet_ntop(sa->sa_family, addr, p, len)); + return (p); } char * VRT_int_string(const struct sess *sp, int num) { char *p; - int size = 12; - - p = WS_Alloc(sp->http->ws, size); - AN(p); + int size; + + size = snprintf(NULL, 0, "%d", num) + 1; + AN(p = WS_Alloc(sp->http->ws, size)); assert(snprintf(p, size, "%d", num) < size); return (p); } +char * +VRT_double_string(const struct sess *sp, double num) +{ + char *p; + int size; + + size = snprintf(NULL, 0, "%.3f", num) + 1; + AN(p = WS_Alloc(sp->http->ws, size)); + assert((p = malloc(size)) != 0); + assert(snprintf(p, size, "%.3f", num) < size); + return (p); +} + /*--------------------------------------------------------------------*/ void Modified: trunk/varnish-cache/include/vrt.h =================================================================== --- trunk/varnish-cache/include/vrt.h 2008-03-03 10:53:31 UTC (rev 2545) +++ trunk/varnish-cache/include/vrt.h 2008-03-03 17:03:05 UTC (rev 2546) @@ -135,6 +135,7 @@ char *VRT_IP_string(const struct sess *sp, const struct sockaddr *sa); char *VRT_int_string(const struct sess *sp, int); +char *VRT_double_string(const struct sess *sp, double); #define VRT_done(sp, hand) \ do { \ From des at projects.linpro.no Mon Mar 3 17:03:53 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 3 Mar 2008 18:03:53 +0100 (CET) Subject: r2547 - trunk/varnish-cache/lib/libvcl Message-ID: <20080303170353.8F5B41EC1D1@projects.linpro.no> Author: des Date: 2008-03-03 18:03:53 +0100 (Mon, 03 Mar 2008) New Revision: 2547 Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c Log: Regen for VRT_double_string() Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-03-03 17:03:05 UTC (rev 2546) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-03-03 17:03:53 UTC (rev 2547) @@ -489,6 +489,7 @@ vsb_cat(sb, "\n"); vsb_cat(sb, "char *VRT_IP_string(const struct sess *sp, const struct sockaddr *sa);\n"); vsb_cat(sb, "char *VRT_int_string(const struct sess *sp, int);\n"); + vsb_cat(sb, "char *VRT_double_string(const struct sess *sp, double);\n"); vsb_cat(sb, "\n"); vsb_cat(sb, "#define VRT_done(sp, hand) \\\n"); vsb_cat(sb, " do { \\\n"); From phk at projects.linpro.no Tue Mar 4 08:54:53 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 4 Mar 2008 09:54:53 +0100 (CET) Subject: r2548 - trunk/varnish-cache/bin/varnishd Message-ID: <20080304085453.51A3F1EC0B7@projects.linpro.no> Author: phk Date: 2008-03-04 09:54:53 +0100 (Tue, 04 Mar 2008) New Revision: 2548 Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c Log: Polish CLI output Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-03-03 17:03:53 UTC (rev 2547) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-03-04 08:54:53 UTC (rev 2548) @@ -159,12 +159,12 @@ else u = strtoul(arg, NULL, 0); if (u < min) { - cli_out(cli, "Must be at least %u", min); + cli_out(cli, "Must be at least %u\n", min); cli_result(cli, CLIS_PARAM); return; } if (u > max) { - cli_out(cli, "Must be no more than %u", max); + cli_out(cli, "Must be no more than %u\n", max); cli_result(cli, CLIS_PARAM); return; } @@ -747,12 +747,14 @@ for (pp = parspec; pp->name != NULL; pp++) { if (!strcmp(pp->name, param)) { pp->func(cli, pp, val); - if (pp->flags & MUST_RESTART) - cli_out(cli, "change will take effect" + if (cli->result != CLIS_OK) { + } else if (child_pid >= 0 && pp->flags & MUST_RESTART) { + cli_out(cli, "Change will take effect" " when child is restarted"); - if (pp->flags & MUST_RELOAD) - cli_out(cli, "change will take effect" + } else if (pp->flags & MUST_RELOAD) { + cli_out(cli, "Change will take effect" " when VCL script is reloaded"); + } MCF_ParamSync(); return; } From des at projects.linpro.no Tue Mar 4 09:29:54 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 4 Mar 2008 10:29:54 +0100 (CET) Subject: r2549 - trunk/varnish-cache/lib/libvcl Message-ID: <20080304092954.5917A1EC1D1@projects.linpro.no> Author: des Date: 2008-03-04 10:29:54 +0100 (Tue, 04 Mar 2008) New Revision: 2549 Modified: trunk/varnish-cache/lib/libvcl/vcc_string.c Log: The final piece of the double -> string puzzle. Modified: trunk/varnish-cache/lib/libvcl/vcc_string.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_string.c 2008-03-04 08:54:53 UTC (rev 2548) +++ trunk/varnish-cache/lib/libvcl/vcc_string.c 2008-03-04 09:29:54 UTC (rev 2549) @@ -145,6 +145,9 @@ case INT: Fb(tl, 0, "VRT_int_string(sp, %s)", vp->rname); break; + case FLOAT: + Fb(tl, 0, "VRT_double_string(sp, %s)", vp->rname); + break; default: vsb_printf(tl->sb, "String representation of '%s' not implemented yet.\n", From des at projects.linpro.no Tue Mar 4 10:58:02 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 4 Mar 2008 11:58:02 +0100 (CET) Subject: r2550 - trunk/varnish-cache/bin/varnishd Message-ID: <20080304105802.427BD1EC0B7@projects.linpro.no> Author: des Date: 2008-03-04 11:58:02 +0100 (Tue, 04 Mar 2008) New Revision: 2550 Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c Log: Remove duplicate allocation. Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2008-03-04 09:29:54 UTC (rev 2549) +++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2008-03-04 10:58:02 UTC (rev 2550) @@ -599,7 +599,6 @@ size = snprintf(NULL, 0, "%.3f", num) + 1; AN(p = WS_Alloc(sp->http->ws, size)); - assert((p = malloc(size)) != 0); assert(snprintf(p, size, "%.3f", num) < size); return (p); } From des at projects.linpro.no Tue Mar 4 10:59:33 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 4 Mar 2008 11:59:33 +0100 (CET) Subject: r2551 - in trunk/varnish-cache: bin/varnishd include lib/libvcl Message-ID: <20080304105933.2043C1EC1D1@projects.linpro.no> Author: des Date: 2008-03-04 11:59:32 +0100 (Tue, 04 Mar 2008) New Revision: 2551 Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c trunk/varnish-cache/include/vrt_obj.h trunk/varnish-cache/lib/libvcl/vcc_obj.c Log: Implement obj.hash. Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2008-03-04 10:58:02 UTC (rev 2550) +++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2008-03-04 10:59:32 UTC (rev 2551) @@ -539,6 +539,16 @@ return (TIM_real() - sp->obj->last_use); } +const char * +VRT_r_obj_hash(struct sess *sp) +{ + + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); + CHECK_OBJ_NOTNULL(sp->obj->objhead, OBJHEAD_MAGIC); + return (sp->obj->objhead->hash); +} + int VRT_r_backend_health(const struct sess *sp) { Modified: trunk/varnish-cache/include/vrt_obj.h =================================================================== --- trunk/varnish-cache/include/vrt_obj.h 2008-03-04 10:58:02 UTC (rev 2550) +++ trunk/varnish-cache/include/vrt_obj.h 2008-03-04 10:59:32 UTC (rev 2551) @@ -43,6 +43,7 @@ double VRT_r_obj_prefetch(const struct sess *); void VRT_l_obj_prefetch(const struct sess *, double); double VRT_r_obj_lastuse(const struct sess *); +const char *VRT_r_obj_hash(struct sess *sp); const char * VRT_r_resp_proto(const struct sess *); void VRT_l_resp_proto(const struct sess *, const char *, ...); int VRT_r_resp_status(const struct sess *); Modified: trunk/varnish-cache/lib/libvcl/vcc_obj.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_obj.c 2008-03-04 10:58:02 UTC (rev 2550) +++ trunk/varnish-cache/lib/libvcl/vcc_obj.c 2008-03-04 10:59:32 UTC (rev 2551) @@ -179,6 +179,13 @@ 0, VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_DISCARD | VCL_MET_TIMEOUT }, + { "obj.hash", HASH, 8, + NULL, + "VRT_l_req_hash(sp, ", + V_RO, + 0, + VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER + }, { "resp.proto", STRING, 10, "VRT_r_resp_proto(sp)", "VRT_l_resp_proto(sp, ", From des at projects.linpro.no Tue Mar 4 11:02:25 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 4 Mar 2008 12:02:25 +0100 (CET) Subject: r2552 - trunk/varnish-cache/lib/libvcl Message-ID: <20080304110225.739FE1EC0B7@projects.linpro.no> Author: des Date: 2008-03-04 12:02:25 +0100 (Tue, 04 Mar 2008) New Revision: 2552 Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl trunk/varnish-cache/lib/libvcl/vcc_obj.c Log: Define obj.hash in the correct place, and regen. Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-03-04 10:59:32 UTC (rev 2551) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-03-04 11:02:25 UTC (rev 2552) @@ -541,6 +541,7 @@ vsb_cat(sb, "double VRT_r_obj_prefetch(const struct sess *);\n"); vsb_cat(sb, "void VRT_l_obj_prefetch(const struct sess *, double);\n"); vsb_cat(sb, "double VRT_r_obj_lastuse(const struct sess *);\n"); + vsb_cat(sb, "const char *VRT_r_obj_hash(struct sess *sp);\n"); vsb_cat(sb, "const char * VRT_r_resp_proto(const struct sess *);\n"); vsb_cat(sb, "void VRT_l_resp_proto(const struct sess *, const char *, ...);\n"); vsb_cat(sb, "int VRT_r_resp_status(const struct sess *);\n"); Modified: trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl 2008-03-04 10:59:32 UTC (rev 2551) +++ trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl 2008-03-04 11:02:25 UTC (rev 2552) @@ -170,6 +170,10 @@ { hit fetch deliver discard timeout} "const struct sess *" } + { obj.hash + RO STRING + { miss hit fetch deliver } + } # The response we send back { resp.proto Modified: trunk/varnish-cache/lib/libvcl/vcc_obj.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_obj.c 2008-03-04 10:59:32 UTC (rev 2551) +++ trunk/varnish-cache/lib/libvcl/vcc_obj.c 2008-03-04 11:02:25 UTC (rev 2552) @@ -179,9 +179,9 @@ 0, VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_DISCARD | VCL_MET_TIMEOUT }, - { "obj.hash", HASH, 8, + { "obj.hash", STRING, 8, + "VRT_r_obj_hash(sp)", NULL, - "VRT_l_req_hash(sp, ", V_RO, 0, VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER From des at projects.linpro.no Tue Mar 4 11:03:03 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 4 Mar 2008 12:03:03 +0100 (CET) Subject: r2553 - trunk/varnish-cache/include Message-ID: <20080304110303.E8A101EC418@projects.linpro.no> Author: des Date: 2008-03-04 12:03:03 +0100 (Tue, 04 Mar 2008) New Revision: 2553 Modified: trunk/varnish-cache/include/vrt_obj.h Log: Regen Modified: trunk/varnish-cache/include/vrt_obj.h =================================================================== --- trunk/varnish-cache/include/vrt_obj.h 2008-03-04 11:02:25 UTC (rev 2552) +++ trunk/varnish-cache/include/vrt_obj.h 2008-03-04 11:03:03 UTC (rev 2553) @@ -43,7 +43,7 @@ double VRT_r_obj_prefetch(const struct sess *); void VRT_l_obj_prefetch(const struct sess *, double); double VRT_r_obj_lastuse(const struct sess *); -const char *VRT_r_obj_hash(struct sess *sp); +const char * VRT_r_obj_hash(); const char * VRT_r_resp_proto(const struct sess *); void VRT_l_resp_proto(const struct sess *, const char *, ...); int VRT_r_resp_status(const struct sess *); From des at projects.linpro.no Tue Mar 4 11:42:00 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 4 Mar 2008 12:42:00 +0100 (CET) Subject: r2554 - in trunk/varnish-cache: bin/varnishd include lib/libvcl Message-ID: <20080304114200.CC4C41EC0B7@projects.linpro.no> Author: des Date: 2008-03-04 12:42:00 +0100 (Tue, 04 Mar 2008) New Revision: 2554 Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c trunk/varnish-cache/include/vrt_obj.h trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl Log: Relax assertions, and fix the build. Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2008-03-04 11:03:03 UTC (rev 2553) +++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2008-03-04 11:42:00 UTC (rev 2554) @@ -540,11 +540,15 @@ } const char * -VRT_r_obj_hash(struct sess *sp) +VRT_r_obj_hash(const struct sess *sp) { CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + if (sp->obj == NULL) + return (NULL); CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); + if (sp->obj->objhead == NULL) + return (NULL); CHECK_OBJ_NOTNULL(sp->obj->objhead, OBJHEAD_MAGIC); return (sp->obj->objhead->hash); } Modified: trunk/varnish-cache/include/vrt_obj.h =================================================================== --- trunk/varnish-cache/include/vrt_obj.h 2008-03-04 11:03:03 UTC (rev 2553) +++ trunk/varnish-cache/include/vrt_obj.h 2008-03-04 11:42:00 UTC (rev 2554) @@ -43,7 +43,7 @@ double VRT_r_obj_prefetch(const struct sess *); void VRT_l_obj_prefetch(const struct sess *, double); double VRT_r_obj_lastuse(const struct sess *); -const char * VRT_r_obj_hash(); +const char * VRT_r_obj_hash(const struct sess *); const char * VRT_r_resp_proto(const struct sess *); void VRT_l_resp_proto(const struct sess *, const char *, ...); int VRT_r_resp_status(const struct sess *); Modified: trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl 2008-03-04 11:03:03 UTC (rev 2553) +++ trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl 2008-03-04 11:42:00 UTC (rev 2554) @@ -173,6 +173,7 @@ { obj.hash RO STRING { miss hit fetch deliver } + "const struct sess *" } # The response we send back From phk at projects.linpro.no Wed Mar 5 13:18:39 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 5 Mar 2008 14:18:39 +0100 (CET) Subject: r2555 - trunk/varnish-cache/bin/varnishd Message-ID: <20080305131839.CEB9B1EC418@projects.linpro.no> Author: phk Date: 2008-03-05 14:18:39 +0100 (Wed, 05 Mar 2008) New Revision: 2555 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c Log: Check EOF as bitflag in kqueue return flags Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2008-03-04 11:42:00 UTC (rev 2554) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2008-03-05 13:18:39 UTC (rev 2555) @@ -132,7 +132,7 @@ VTAILQ_REMOVE(&sesshead, sp, list); vca_handover(sp, i); return; - } else if (kp->flags == EV_EOF) { + } else if (kp->flags & EV_EOF) { VTAILQ_REMOVE(&sesshead, sp, list); vca_close_session(sp, "EOF"); SES_Delete(sp); From phk at projects.linpro.no Fri Mar 7 10:36:41 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 7 Mar 2008 11:36:41 +0100 (CET) Subject: r2556 - trunk/varnish-cache/bin/varnishd Message-ID: <20080307103641.442B21EC0B7@projects.linpro.no> Author: phk Date: 2008-03-07 11:36:40 +0100 (Fri, 07 Mar 2008) New Revision: 2556 Modified: trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/bin/varnishd/cache_hash.c trunk/varnish-cache/bin/varnishd/mgt_param.c Log: Put waiting list shmlogs under diag_bitmap Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2008-03-05 13:18:39 UTC (rev 2555) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2008-03-07 10:36:40 UTC (rev 2556) @@ -550,7 +550,9 @@ * hash code to restart us, still in STP_LOOKUP, later. */ spassert(sp->objhead != NULL); - WSP(sp, SLT_Debug, "on waiting list <%s>", sp->objhead->hash); + if (params->diag_bitmap & 0x20) + WSP(sp, SLT_Debug, + "on waiting list <%s>", sp->objhead->hash); /* * There is a non-zero risk that we come here more than once * before we get through, in that case cnt_recv must be set Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_hash.c 2008-03-05 13:18:39 UTC (rev 2555) +++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2008-03-07 10:36:40 UTC (rev 2556) @@ -278,7 +278,8 @@ if (sp == NULL) return; VTAILQ_REMOVE(&oh->waitinglist, sp, list); - VSL(SLT_Debug, sp->id, "of waiting list"); + if (params->diag_bitmap & 0x20) + VSL(SLT_Debug, sp->id, "off waiting list"); WRK_QueueSession(sp); } } Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-03-05 13:18:39 UTC (rev 2555) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-03-07 10:36:40 UTC (rev 2556) @@ -643,6 +643,7 @@ " 0x00000004 - kqueue debugging.\n" " 0x00000008 - mutex logging.\n" " 0x00000010 - mutex contests.\n" + " 0x00000020 - waiting list.\n" "Use 0x notation and do the bitor in your head :-)\n", 0, "0", "bitmap" }, From phk at projects.linpro.no Fri Mar 7 10:58:12 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 7 Mar 2008 11:58:12 +0100 (CET) Subject: r2557 - in trunk/varnish-cache: bin/varnishd include Message-ID: <20080307105812.B02031EC418@projects.linpro.no> Author: phk Date: 2008-03-07 11:58:12 +0100 (Fri, 07 Mar 2008) New Revision: 2557 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/bin/varnishd/cache_expire.c trunk/varnish-cache/bin/varnishd/cache_synthetic.c trunk/varnish-cache/bin/varnishd/shmlog.c trunk/varnish-cache/include/stat_field.h Log: Keep track of how often we flush the private shm buffer due to overflows. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-03-07 10:36:40 UTC (rev 2556) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-03-07 10:58:12 UTC (rev 2557) @@ -520,7 +520,7 @@ void VSL(enum shmlogtag tag, int id, const char *fmt, ...); void WSLR(struct worker *w, enum shmlogtag tag, int id, txt t); void WSL(struct worker *w, enum shmlogtag tag, int id, const char *fmt, ...); -void WSL_Flush(struct worker *w); +void WSL_Flush(struct worker *w, int overflow); #define WSP(sess, tag, fmt, ...) \ WSL((sess)->wrk, tag, (sess)->fd, fmt, __VA_ARGS__) #define WSPR(sess, tag, txt) \ Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2008-03-07 10:36:40 UTC (rev 2556) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2008-03-07 10:58:12 UTC (rev 2557) @@ -228,7 +228,7 @@ sp->t_open = sp->t_end; sp->t_req = NAN; sp->t_resp = NAN; - WSL_Flush(sp->wrk); + WSL_Flush(sp->wrk, 0); /* If we did an ESI include, don't mess up our state */ if (sp->esis > 0) @@ -879,7 +879,7 @@ WSL(sp->wrk, SLT_Debug, sp->id, "thr %p STP_%s sp %p obj %p vcl %p", pthread_self(), state, sp, sp->obj, sp->vcl); - WSL_Flush(sp->wrk); + WSL_Flush(sp->wrk, 0); } else { VSL(SLT_Debug, sp->id, "thr %p STP_%s sp %p obj %p vcl %p", @@ -925,7 +925,7 @@ CHECK_OBJ_ORNULL(w->nobjhead, OBJHEAD_MAGIC); } assert(!isnan(w->used)); - WSL_Flush(w); + WSL_Flush(w, 0); } /* Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_expire.c 2008-03-07 10:36:40 UTC (rev 2556) +++ trunk/varnish-cache/bin/varnishd/cache_expire.c 2008-03-07 10:58:12 UTC (rev 2557) @@ -280,7 +280,7 @@ CHECK_OBJ_ORNULL(oe, OBJEXP_MAGIC); if (oe == NULL || oe->timer_when > t) { /* XXX: > or >= ? */ UNLOCK(&exp_mtx); - WSL_Flush(&ww); + WSL_Flush(&ww, 0); AZ(sleep(1)); VCL_Refresh(&sp->vcl); t = TIM_real(); Modified: trunk/varnish-cache/bin/varnishd/cache_synthetic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_synthetic.c 2008-03-07 10:36:40 UTC (rev 2556) +++ trunk/varnish-cache/bin/varnishd/cache_synthetic.c 2008-03-07 10:58:12 UTC (rev 2557) @@ -59,7 +59,7 @@ int fd; int ttl = 0; /* XXX: ?? */ - WSL_Flush(sp->wrk); + WSL_Flush(sp->wrk, 0); assert(status >= 100 && status <= 999); CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC); Modified: trunk/varnish-cache/bin/varnishd/shmlog.c =================================================================== --- trunk/varnish-cache/bin/varnishd/shmlog.c 2008-03-07 10:36:40 UTC (rev 2556) +++ trunk/varnish-cache/bin/varnishd/shmlog.c 2008-03-07 10:58:12 UTC (rev 2557) @@ -170,7 +170,7 @@ /*--------------------------------------------------------------------*/ void -WSL_Flush(struct worker *w) +WSL_Flush(struct worker *w, int overflow) { unsigned char *p; unsigned l; @@ -179,6 +179,7 @@ if (l == 0) return; LOCKSHM(&vsl_mtx); + VSL_stats->shm_flushes += overflow; VSL_stats->shm_writes++; VSL_stats->shm_records += w->wlr; if (loghead->ptr + l + 1 >= loghead->size) @@ -216,7 +217,7 @@ /* Wrap if necessary */ if (w->wlp + SHMLOG_NEXTTAG + l + 1 >= w->wle) - WSL_Flush(w); + WSL_Flush(w, 1); p = w->wlp; w->wlp += SHMLOG_NEXTTAG + l; assert(w->wlp < w->wle); @@ -247,7 +248,7 @@ /* Wrap if we cannot fit a full size record */ if (w->wlp + SHMLOG_NEXTTAG + 255 + 1 >= w->wle) - WSL_Flush(w); + WSL_Flush(w, 1); p = w->wlp; n = vsnprintf((char *)(p + SHMLOG_DATA), 256, fmt, ap); Modified: trunk/varnish-cache/include/stat_field.h =================================================================== --- trunk/varnish-cache/include/stat_field.h 2008-03-07 10:36:40 UTC (rev 2556) +++ trunk/varnish-cache/include/stat_field.h 2008-03-07 10:58:12 UTC (rev 2557) @@ -88,6 +88,7 @@ MAC_STAT(shm_records, uint64_t, 'a', "SHM records") MAC_STAT(shm_writes, uint64_t, 'a', "SHM writes") +MAC_STAT(shm_flushes, uint64_t, 'a', "SHM flushes due to overflow") MAC_STAT(shm_cont, uint64_t, 'a', "SHM MTX contention") MAC_STAT(sm_nreq, uint64_t, 'a', "allocator requests") From phk at projects.linpro.no Fri Mar 7 11:04:51 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 7 Mar 2008 12:04:51 +0100 (CET) Subject: r2558 - trunk/varnish-cache/bin/varnishd Message-ID: <20080307110451.A09B51EC0B7@projects.linpro.no> Author: phk Date: 2008-03-07 12:04:51 +0100 (Fri, 07 Mar 2008) New Revision: 2558 Modified: trunk/varnish-cache/bin/varnishd/shmlog.c Log: Attempt to mlock(2) SHMFILE in core. Modified: trunk/varnish-cache/bin/varnishd/shmlog.c =================================================================== --- trunk/varnish-cache/bin/varnishd/shmlog.c 2008-03-07 10:58:12 UTC (rev 2557) +++ trunk/varnish-cache/bin/varnishd/shmlog.c 2008-03-07 11:04:51 UTC (rev 2558) @@ -347,6 +347,10 @@ MAP_HASSEMAPHORE | MAP_NOSYNC | MAP_SHARED, heritage.vsl_fd, 0); xxxassert(loghead != MAP_FAILED); + i = mlock(loghead, heritage.vsl_size); + if (i != 0) + fprintf(stderr, "Notice: locking SHMFILE in core failed: %s\n", + strerror(errno)); VSL_stats = &loghead->stats; pp = (void *)(loghead + 1); *pp = *params; From phk at projects.linpro.no Fri Mar 7 11:13:12 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 7 Mar 2008 12:13:12 +0100 (CET) Subject: r2559 - trunk/varnish-cache/bin/varnishd Message-ID: <20080307111312.161711EC1D1@projects.linpro.no> Author: phk Date: 2008-03-07 12:13:11 +0100 (Fri, 07 Mar 2008) New Revision: 2559 Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c trunk/varnish-cache/bin/varnishd/cache_hash.c trunk/varnish-cache/bin/varnishd/cache_session.c trunk/varnish-cache/bin/varnishd/heritage.h trunk/varnish-cache/bin/varnishd/mgt_param.c Log: Split the http_workspace into sess_workspace and obj_workspace, so they can be tuned separately. Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend.c 2008-03-07 11:04:51 UTC (rev 2558) +++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2008-03-07 11:13:11 UTC (rev 2559) @@ -230,7 +230,7 @@ if (bereq != NULL) { CHECK_OBJ(bereq, BEREQ_MAGIC); } else { - len = params->mem_workspace; + len = params->sess_workspace; bereq = calloc(sizeof *bereq + len, 1); if (bereq == NULL) return (NULL); Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_hash.c 2008-03-07 11:04:51 UTC (rev 2558) +++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2008-03-07 11:13:11 UTC (rev 2559) @@ -88,7 +88,7 @@ } else CHECK_OBJ_NOTNULL(w->nobjhead, OBJHEAD_MAGIC); if (w->nobj == NULL) { - st = STV_alloc(sp, params->mem_workspace); + st = STV_alloc(sp, params->obj_workspace); XXXAN(st); assert(st->space > sizeof *w->nobj); w->nobj = (void *)st->ptr; /* XXX: align ? */ Modified: trunk/varnish-cache/bin/varnishd/cache_session.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_session.c 2008-03-07 11:04:51 UTC (rev 2558) +++ trunk/varnish-cache/bin/varnishd/cache_session.c 2008-03-07 11:13:11 UTC (rev 2559) @@ -289,7 +289,7 @@ * need to cache it locally, to make sure we get a * consistent view of it. */ - u = params->mem_workspace; + u = params->sess_workspace; sm = malloc(sizeof *sm + u); if (sm == NULL) return (NULL); @@ -346,7 +346,7 @@ sp->addr, sp->port, sp->t_end - b->first, b->sess, b->req, b->pipe, b->pass, b->fetch, b->hdrbytes, b->bodybytes); - if (sm->workspace != params->mem_workspace) { + if (sm->workspace != params->sess_workspace) { VSL_stats->n_sess_mem--; free(sm); } else { Modified: trunk/varnish-cache/bin/varnishd/heritage.h =================================================================== --- trunk/varnish-cache/bin/varnishd/heritage.h 2008-03-07 11:04:51 UTC (rev 2558) +++ trunk/varnish-cache/bin/varnishd/heritage.h 2008-03-07 11:13:11 UTC (rev 2559) @@ -85,7 +85,8 @@ unsigned overflow_max; /* Memory allocation hints */ - unsigned mem_workspace; + unsigned sess_workspace; + unsigned obj_workspace; /* Acceptor hints */ unsigned sess_timeout; Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-03-07 11:04:51 UTC (rev 2558) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-03-07 11:13:11 UTC (rev 2559) @@ -495,13 +495,21 @@ "number of worker threads. ", EXPERIMENTAL, "3", "requests per request" }, - { "http_workspace", tweak_uint, &master.mem_workspace, 1024, UINT_MAX, - "Bytes of HTTP protocol workspace allocated. " + { "sess_workspace", tweak_uint, &master.sess_workspace, 1024, UINT_MAX, + "Bytes of HTTP protocol workspace allocated for sessions. " "This space must be big enough for the entire HTTP protocol " "header and any edits done to it in the VCL code.\n" "Minimum is 1024 bytes.", DELAYED_EFFECT, "8192", "bytes" }, + { "obj_workspace", tweak_uint, &master.obj_workspace, 1024, UINT_MAX, + "Bytes of HTTP protocol workspace allocated for objects. " + "This space must be big enough for the entire HTTP protocol " + "header and any edits done to it in the VCL code while it " + "is cached.\n" + "Minimum is 1024 bytes.", + DELAYED_EFFECT, + "8192", "bytes" }, { "sess_timeout", tweak_timeout, &master.sess_timeout, 0, 0, "Idle timeout for persistent sessions. " "If a HTTP request has not been received in this many " From phk at projects.linpro.no Fri Mar 7 11:36:52 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 7 Mar 2008 12:36:52 +0100 (CET) Subject: r2560 - in trunk/varnish-cache: bin/varnishd include Message-ID: <20080307113652.727B61EC0B7@projects.linpro.no> Author: phk Date: 2008-03-07 12:36:52 +0100 (Fri, 07 Mar 2008) New Revision: 2560 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/bin/varnishd/cache_hash.c trunk/varnish-cache/bin/varnishd/cache_ws.c trunk/varnish-cache/bin/varnishd/mgt_param.c trunk/varnish-cache/include/stat_field.h Log: Add diagnostic features to keep track of object workspace usage. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-03-07 11:13:11 UTC (rev 2559) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-03-07 11:36:52 UTC (rev 2560) @@ -107,6 +107,7 @@ char *f; /* (F)ree pointer */ char *r; /* (R)eserved length */ char *e; /* (E)nd of buffer */ + int overflow; /* workspace overflowed */ }; /*-------------------------------------------------------------------- @@ -444,7 +445,7 @@ int HSH_Compare(const struct sess *sp, const struct objhead *o); void HSH_Copy(const struct sess *sp, const struct objhead *o); struct object *HSH_Lookup(struct sess *sp); -void HSH_Unbusy(struct object *o); +void HSH_Unbusy(struct sess *sp); void HSH_Ref(struct object *o); void HSH_Deref(struct object *o); void HSH_Init(void); @@ -580,6 +581,7 @@ char *WS_Alloc(struct ws *ws, unsigned bytes); char *WS_Dup(struct ws *ws, const char *); char *WS_Snapshot(struct ws *ws); +unsigned WS_Used(struct ws *ws); /* rfc2616.c */ int RFC2616_cache_policy(const struct sess *sp, const struct http *hp); Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2008-03-07 11:13:11 UTC (rev 2559) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2008-03-07 11:36:52 UTC (rev 2560) @@ -352,7 +352,7 @@ case VCL_RET_RESTART: sp->obj->ttl = 0; sp->obj->cacheable = 0; - HSH_Unbusy(sp->obj); + HSH_Unbusy(sp); HSH_Deref(sp->obj); sp->obj = NULL; if (sp->handling == VCL_RET_ERROR) @@ -375,7 +375,7 @@ if (sp->obj->objhead != NULL) { VRY_Create(sp); EXP_Insert(sp->obj, sp->wrk->used); - HSH_Unbusy(sp->obj); + HSH_Unbusy(sp); } sp->wrk->acct.fetch++; sp->step = STP_DELIVER; @@ -626,7 +626,7 @@ VCL_miss_method(sp); if (sp->handling == VCL_RET_ERROR) { sp->obj->cacheable = 0; - HSH_Unbusy(sp->obj); + HSH_Unbusy(sp); HSH_Deref(sp->obj); sp->obj = NULL; VBE_free_bereq(sp->bereq); @@ -636,7 +636,7 @@ } if (sp->handling == VCL_RET_PASS) { sp->obj->cacheable = 0; - HSH_Unbusy(sp->obj); + HSH_Unbusy(sp); HSH_Deref(sp->obj); sp->obj = NULL; sp->step = STP_PASS; Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_hash.c 2008-03-07 11:13:11 UTC (rev 2559) +++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2008-03-07 11:36:52 UTC (rev 2560) @@ -285,14 +285,23 @@ } void -HSH_Unbusy(struct object *o) +HSH_Unbusy(struct sess *sp) { + struct object *o; struct objhead *oh; struct object *parent; + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + o = sp->obj; CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); assert(o->busy); assert(o->refcnt > 0); + if (o->ws_o->overflow) + VSL_stats->n_objoverflow++; + if (params->diag_bitmap & 0x40) + WSP(sp, SLT_Debug, + "Object workspace used %u", WS_Used(o->ws_o)); + oh = o->objhead; if (oh != NULL) { CHECK_OBJ(oh, OBJHEAD_MAGIC); @@ -356,6 +365,10 @@ if (r != 0) return; + if (params->diag_bitmap & 0x40) + VSL(SLT_Debug, 0, + "Object workspace max used %u", WS_Used(o->ws_o)); + if (o->vary != NULL) free(o->vary); Modified: trunk/varnish-cache/bin/varnishd/cache_ws.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_ws.c 2008-03-07 11:13:11 UTC (rev 2559) +++ trunk/varnish-cache/bin/varnishd/cache_ws.c 2008-03-07 11:36:52 UTC (rev 2560) @@ -111,8 +111,10 @@ WS_Assert(ws); assert(ws->r == NULL); - if (ws->f + bytes > ws->e) + if (ws->f + bytes > ws->e) { + ws->overflow++; return(NULL); + } r = ws->f; ws->f += bytes; WS_DEBUG("WS_Alloc(%p, %u) = %p", ws, bytes, r); @@ -133,6 +135,14 @@ return (p); } +unsigned +WS_Used(struct ws *ws) +{ + + WS_Assert(ws); + return(ws->f - ws->s); +} + char * WS_Snapshot(struct ws *ws) { Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-03-07 11:13:11 UTC (rev 2559) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-03-07 11:36:52 UTC (rev 2560) @@ -652,6 +652,7 @@ " 0x00000008 - mutex logging.\n" " 0x00000010 - mutex contests.\n" " 0x00000020 - waiting list.\n" + " 0x00000040 - object workspace.\n" "Use 0x notation and do the bitor in your head :-)\n", 0, "0", "bitmap" }, Modified: trunk/varnish-cache/include/stat_field.h =================================================================== --- trunk/varnish-cache/include/stat_field.h 2008-03-07 11:13:11 UTC (rev 2559) +++ trunk/varnish-cache/include/stat_field.h 2008-03-07 11:36:52 UTC (rev 2560) @@ -72,6 +72,7 @@ MAC_STAT(n_objsendfile, uint64_t, 'a', "Objects sent with sendfile") MAC_STAT(n_objwrite, uint64_t, 'a', "Objects sent with write") +MAC_STAT(n_objoverflow, uint64_t, 'a', "Objects overflowing workspace") MAC_STAT(s_sess, uint64_t, 'a', "Total Sessions") MAC_STAT(s_req, uint64_t, 'a', "Total Requests") From phk at projects.linpro.no Fri Mar 7 11:43:38 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 7 Mar 2008 12:43:38 +0100 (CET) Subject: r2561 - trunk/varnish-cache/bin/varnishd Message-ID: <20080307114338.6563C1EC1D1@projects.linpro.no> Author: phk Date: 2008-03-07 12:43:38 +0100 (Fri, 07 Mar 2008) New Revision: 2561 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_hash.c trunk/varnish-cache/bin/varnishd/cache_ws.c Log: Log free object workspace instead of used to get the size of the object structure into the picture. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-03-07 11:36:52 UTC (rev 2560) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-03-07 11:43:38 UTC (rev 2561) @@ -581,7 +581,7 @@ char *WS_Alloc(struct ws *ws, unsigned bytes); char *WS_Dup(struct ws *ws, const char *); char *WS_Snapshot(struct ws *ws); -unsigned WS_Used(struct ws *ws); +unsigned WS_Free(struct ws *ws); /* rfc2616.c */ int RFC2616_cache_policy(const struct sess *sp, const struct http *hp); Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_hash.c 2008-03-07 11:36:52 UTC (rev 2560) +++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2008-03-07 11:43:38 UTC (rev 2561) @@ -300,7 +300,7 @@ VSL_stats->n_objoverflow++; if (params->diag_bitmap & 0x40) WSP(sp, SLT_Debug, - "Object workspace used %u", WS_Used(o->ws_o)); + "Object %u workspace free %u", o->xid, WS_Free(o->ws_o)); oh = o->objhead; if (oh != NULL) { @@ -366,8 +366,8 @@ return; if (params->diag_bitmap & 0x40) - VSL(SLT_Debug, 0, - "Object workspace max used %u", WS_Used(o->ws_o)); + VSL(SLT_Debug, 0, "Object %u workspace min free %u", + o->xid, WS_Free(o->ws_o)); if (o->vary != NULL) free(o->vary); Modified: trunk/varnish-cache/bin/varnishd/cache_ws.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_ws.c 2008-03-07 11:36:52 UTC (rev 2560) +++ trunk/varnish-cache/bin/varnishd/cache_ws.c 2008-03-07 11:43:38 UTC (rev 2561) @@ -136,11 +136,11 @@ } unsigned -WS_Used(struct ws *ws) +WS_Free(struct ws *ws) { WS_Assert(ws); - return(ws->f - ws->s); + return(ws->e - ws->f); } char * From ingvar at projects.linpro.no Fri Mar 7 15:07:31 2008 From: ingvar at projects.linpro.no (ingvar at projects.linpro.no) Date: Fri, 7 Mar 2008 16:07:31 +0100 (CET) Subject: r2562 - trunk/varnish-cache/redhat Message-ID: <20080307150731.4E46E1EC0B7@projects.linpro.no> Author: ingvar Date: 2008-03-07 16:07:31 +0100 (Fri, 07 Mar 2008) New Revision: 2562 Modified: trunk/varnish-cache/redhat/varnish.initrc trunk/varnish-cache/redhat/varnish.spec trunk/varnish-cache/redhat/varnish.sysconfig Log: This is more pre-2.0 than 1.1.2+ Modified: trunk/varnish-cache/redhat/varnish.initrc =================================================================== --- trunk/varnish-cache/redhat/varnish.initrc 2008-03-07 11:43:38 UTC (rev 2561) +++ trunk/varnish-cache/redhat/varnish.initrc 2008-03-07 15:07:31 UTC (rev 2562) @@ -26,6 +26,9 @@ # Open files (usually 1024, which is way too small for varnish) ulimit -n ${NFILES:-131072} +# Varnish wants to lock shared memory log in memory. +ulimit -l ${MEMLOCK:-82000} + # See how we were called. case "$1" in start) Modified: trunk/varnish-cache/redhat/varnish.spec =================================================================== --- trunk/varnish-cache/redhat/varnish.spec 2008-03-07 11:43:38 UTC (rev 2561) +++ trunk/varnish-cache/redhat/varnish.spec 2008-03-07 15:07:31 UTC (rev 2562) @@ -1,7 +1,7 @@ Summary: Varnish is a high-performance HTTP accelerator Name: varnish -Version: 1.1.2 -Release: 5%{?dist} +Version: 2.0 +Release: pre_svn20080307%{?dist} License: BSD Group: System Environment/Daemons URL: http://www.varnish-cache.org/ Modified: trunk/varnish-cache/redhat/varnish.sysconfig =================================================================== --- trunk/varnish-cache/redhat/varnish.sysconfig 2008-03-07 11:43:38 UTC (rev 2561) +++ trunk/varnish-cache/redhat/varnish.sysconfig 2008-03-07 15:07:31 UTC (rev 2562) @@ -7,6 +7,10 @@ # Maximum number of open files (for ulimit -n) NFILES=131072 +# Locked shared memory (for ulimit -l) +# Default log size is 82MB + header +MEMLOCK=82000 + # This file contains 4 alternatives, please use only one. ## Alternative 1, Minimal configuration, no VCL From des at projects.linpro.no Sat Mar 8 13:12:02 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sat, 8 Mar 2008 14:12:02 +0100 (CET) Subject: r2563 - branches/1.2/include Message-ID: <20080308131202.772711EC4D5@projects.linpro.no> Author: des Date: 2008-03-08 14:12:02 +0100 (Sat, 08 Mar 2008) New Revision: 2563 Modified: branches/1.2/include/shmlog_tags.h Log: Unbreak binary compatibility between 1.1 and 1.2 logs by moving VCL_error to where it should be, at the end of the list. Modified: branches/1.2/include/shmlog_tags.h =================================================================== --- branches/1.2/include/shmlog_tags.h 2008-03-07 15:07:31 UTC (rev 2562) +++ branches/1.2/include/shmlog_tags.h 2008-03-08 13:12:02 UTC (rev 2563) @@ -84,7 +84,6 @@ SLTM(VCL_call) SLTM(VCL_trace) SLTM(VCL_return) -SLTM(VCL_error) SLTM(ReqStart) SLTM(Hit) SLTM(HitPass) @@ -93,3 +92,5 @@ SLTM(ExpKill) SLTM(WorkThread) SLTM(Terminate) + +SLTM(VCL_error) From des at projects.linpro.no Sat Mar 8 13:38:23 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sat, 8 Mar 2008 14:38:23 +0100 (CET) Subject: r2564 - in branches/1.2: . bin bin/varnishadm bin/varnishd bin/varnishhist bin/varnishlog bin/varnishncsa bin/varnishreplay bin/varnishstat bin/varnishtop include lib/libvarnish lib/libvarnishapi lib/libvarnishcompat lib/libvcl Message-ID: <20080308133823.8F4111EC433@projects.linpro.no> Author: des Date: 2008-03-08 14:38:23 +0100 (Sat, 08 Mar 2008) New Revision: 2564 Modified: branches/1.2/ branches/1.2/autogen.des branches/1.2/bin/Makefile.am branches/1.2/bin/varnishadm/Makefile.am branches/1.2/bin/varnishadm/varnishadm.c branches/1.2/bin/varnishd/Makefile.am branches/1.2/bin/varnishd/cache_acceptor.c branches/1.2/bin/varnishd/cache_acceptor_epoll.c branches/1.2/bin/varnishd/cache_acceptor_kqueue.c branches/1.2/bin/varnishd/cache_acceptor_poll.c branches/1.2/bin/varnishd/cache_backend.c branches/1.2/bin/varnishd/cache_ban.c branches/1.2/bin/varnishd/cache_center.c branches/1.2/bin/varnishd/cache_cli.c branches/1.2/bin/varnishd/cache_expire.c branches/1.2/bin/varnishd/cache_fetch.c branches/1.2/bin/varnishd/cache_hash.c branches/1.2/bin/varnishd/cache_http.c branches/1.2/bin/varnishd/cache_httpconn.c branches/1.2/bin/varnishd/cache_main.c branches/1.2/bin/varnishd/cache_panic.c branches/1.2/bin/varnishd/cache_pipe.c branches/1.2/bin/varnishd/cache_pool.c branches/1.2/bin/varnishd/cache_response.c branches/1.2/bin/varnishd/cache_session.c branches/1.2/bin/varnishd/cache_synthetic.c branches/1.2/bin/varnishd/cache_vary.c branches/1.2/bin/varnishd/cache_vcl.c branches/1.2/bin/varnishd/cache_vrt.c branches/1.2/bin/varnishd/cache_vrt_acl.c branches/1.2/bin/varnishd/cache_vrt_esi.c branches/1.2/bin/varnishd/cache_vrt_re.c branches/1.2/bin/varnishd/cache_ws.c branches/1.2/bin/varnishd/hash_classic.c branches/1.2/bin/varnishd/hash_simple_list.c branches/1.2/bin/varnishd/mgt_child.c branches/1.2/bin/varnishd/mgt_cli.c branches/1.2/bin/varnishd/mgt_event.c branches/1.2/bin/varnishd/mgt_param.c branches/1.2/bin/varnishd/mgt_vcc.c branches/1.2/bin/varnishd/rfc2616.c branches/1.2/bin/varnishd/shmlog.c branches/1.2/bin/varnishd/stevedore.c branches/1.2/bin/varnishd/storage_file.c branches/1.2/bin/varnishd/storage_malloc.c branches/1.2/bin/varnishd/tcp.c branches/1.2/bin/varnishd/varnishd.c branches/1.2/bin/varnishhist/Makefile.am branches/1.2/bin/varnishhist/varnishhist.c branches/1.2/bin/varnishlog/Makefile.am branches/1.2/bin/varnishlog/varnishlog.c branches/1.2/bin/varnishncsa/Makefile.am branches/1.2/bin/varnishncsa/varnishncsa.c branches/1.2/bin/varnishreplay/Makefile.am branches/1.2/bin/varnishreplay/varnishreplay.c branches/1.2/bin/varnishstat/Makefile.am branches/1.2/bin/varnishstat/varnishstat.c branches/1.2/bin/varnishtop/Makefile.am branches/1.2/bin/varnishtop/varnishtop.c branches/1.2/configure.ac branches/1.2/include/binary_heap.h branches/1.2/lib/libvarnish/Makefile.am branches/1.2/lib/libvarnish/argv.c branches/1.2/lib/libvarnish/assert.c branches/1.2/lib/libvarnish/binary_heap.c branches/1.2/lib/libvarnish/cli.c branches/1.2/lib/libvarnish/cli_common.c branches/1.2/lib/libvarnish/crc32.c branches/1.2/lib/libvarnish/flopen.c branches/1.2/lib/libvarnish/time.c branches/1.2/lib/libvarnish/version.c branches/1.2/lib/libvarnish/vpf.c branches/1.2/lib/libvarnish/vsb.c branches/1.2/lib/libvarnish/vss.c branches/1.2/lib/libvarnish/vtmpfile.c branches/1.2/lib/libvarnishapi/Makefile.am branches/1.2/lib/libvarnishapi/base64.c branches/1.2/lib/libvarnishapi/instance.c branches/1.2/lib/libvarnishapi/shmlog.c branches/1.2/lib/libvarnishcompat/Makefile.am branches/1.2/lib/libvarnishcompat/asprintf.c branches/1.2/lib/libvarnishcompat/daemon.c branches/1.2/lib/libvarnishcompat/setproctitle.c branches/1.2/lib/libvarnishcompat/srandomdev.c branches/1.2/lib/libvarnishcompat/strlcat.c branches/1.2/lib/libvarnishcompat/strlcpy.c branches/1.2/lib/libvarnishcompat/strndup.c branches/1.2/lib/libvarnishcompat/vasprintf.c branches/1.2/lib/libvarnishcompat/vis.c branches/1.2/lib/libvcl/Makefile.am branches/1.2/lib/libvcl/vcc_acl.c branches/1.2/lib/libvcl/vcc_action.c branches/1.2/lib/libvcl/vcc_backend.c branches/1.2/lib/libvcl/vcc_compile.c branches/1.2/lib/libvcl/vcc_fixed_token.c branches/1.2/lib/libvcl/vcc_gen_fixed_token.tcl branches/1.2/lib/libvcl/vcc_gen_obj.tcl branches/1.2/lib/libvcl/vcc_obj.c branches/1.2/lib/libvcl/vcc_parse.c branches/1.2/lib/libvcl/vcc_string.c branches/1.2/lib/libvcl/vcc_token.c branches/1.2/lib/libvcl/vcc_var.c branches/1.2/lib/libvcl/vcc_xref.c Log: Merged revisions 2404,2426,2432-2434,2453-2456,2458-2461 via svnmerge from svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache ........ r2404 | phk | 2008-01-30 11:02:19 +0100 (Wed, 30 Jan 2008) | 4 lines Make sure we get the right assert() macro. Constification. ........ r2453 | des | 2008-02-13 14:05:36 +0100 (Wed, 13 Feb 2008) | 4 lines Some source files (especially in libraries) have embedded test programs. Add a configure option and a corresponding automake conditional to enable these tests. ........ r2454 | des | 2008-02-13 14:29:40 +0100 (Wed, 13 Feb 2008) | 2 lines Rewrite str2bytes, add unit test ........ r2455 | des | 2008-02-13 14:55:39 +0100 (Wed, 13 Feb 2008) | 2 lines Use #include "config.h" instead of -include config.h ........ r2456 | des | 2008-02-13 15:58:48 +0100 (Wed, 13 Feb 2008) | 2 lines Disable tools that require curses if no curses library was found. ........ r2458 | des | 2008-02-13 18:12:59 +0100 (Wed, 13 Feb 2008) | 2 lines Enable tests + allow overrides from command line. ........ r2459 | des | 2008-02-13 18:19:52 +0100 (Wed, 13 Feb 2008) | 2 lines Never mind trying to avoid libm, we already use it anyway. ........ r2460 | des | 2008-02-13 18:25:52 +0100 (Wed, 13 Feb 2008) | 2 lines Forgot config.h here ........ r2461 | des | 2008-02-13 18:25:57 +0100 (Wed, 13 Feb 2008) | 2 lines Regenerate ........ Property changes on: branches/1.2 ___________________________________________________________________ Name: svnmerge-integrated - /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317,2319,2321,2323-2327,2358,2362-2364,2366,2374-2381,2384-2386,2414-2415,2426,2432-2434,2444-2445,2457,2492-2494,2500-2502 + /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317,2319,2321,2323-2327,2358,2362-2364,2366,2374-2381,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2492-2494,2500-2502 Modified: branches/1.2/autogen.des =================================================================== --- branches/1.2/autogen.des 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/autogen.des 2008-03-08 13:38:23 UTC (rev 2564) @@ -18,6 +18,8 @@ --enable-diagnostics \ --enable-extra-developer-warnings \ --enable-stack-protector \ + --enable-tests \ --enable-werror \ --prefix=/opt/varnish \ - --mandir=/opt/varnish/man + --mandir=/opt/varnish/man \ + "$@" Modified: branches/1.2/bin/Makefile.am =================================================================== --- branches/1.2/bin/Makefile.am 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/Makefile.am 2008-03-08 13:38:23 UTC (rev 2564) @@ -1,4 +1,7 @@ # $Id$ -SUBDIRS = varnishadm varnishd varnishhist varnishlog varnishncsa \ - varnishreplay varnishstat varnishtop +SUBDIRS = varnishadm varnishd varnishlog varnishncsa varnishreplay + +if HAVE_CURSES +SUBDIRS += varnishhist varnishstat varnishtop +endif Modified: branches/1.2/bin/varnishadm/Makefile.am =================================================================== --- branches/1.2/bin/varnishadm/Makefile.am 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishadm/Makefile.am 2008-03-08 13:38:23 UTC (rev 2564) @@ -8,8 +8,6 @@ varnishadm_SOURCES = \ varnishadm.c - -varnishadm_CFLAGS = -include config.h varnishadm_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ Modified: branches/1.2/bin/varnishadm/varnishadm.c =================================================================== --- branches/1.2/bin/varnishadm/varnishadm.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishadm/varnishadm.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/Makefile.am =================================================================== --- branches/1.2/bin/varnishd/Makefile.am 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/Makefile.am 2008-03-08 13:38:23 UTC (rev 2564) @@ -65,7 +65,7 @@ steps.h \ stevedore.h -varnishd_CFLAGS = -include config.h \ +varnishd_CFLAGS = \ -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' varnishd_LDFLAGS = -export-dynamic Modified: branches/1.2/bin/varnishd/cache_acceptor.c =================================================================== --- branches/1.2/bin/varnishd/cache_acceptor.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_acceptor.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -33,6 +33,8 @@ * write the session pointer to a pipe which the event engine monitors. */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/cache_acceptor_epoll.c =================================================================== --- branches/1.2/bin/varnishd/cache_acceptor_epoll.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_acceptor_epoll.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * write the session pointer to a pipe which the event engine monitors. */ +#include "config.h" + #if defined(HAVE_EPOLL_CTL) #include Modified: branches/1.2/bin/varnishd/cache_acceptor_kqueue.c =================================================================== --- branches/1.2/bin/varnishd/cache_acceptor_kqueue.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_acceptor_kqueue.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -33,6 +33,8 @@ * write the session pointer to a pipe which the event engine monitors. */ +#include "config.h" + #if defined(HAVE_KQUEUE) #include Modified: branches/1.2/bin/varnishd/cache_acceptor_poll.c =================================================================== --- branches/1.2/bin/varnishd/cache_acceptor_poll.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_acceptor_poll.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -30,6 +30,8 @@ * */ +#include "config.h" + #if defined(HAVE_POLL) #include Modified: branches/1.2/bin/varnishd/cache_backend.c =================================================================== --- branches/1.2/bin/varnishd/cache_backend.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_backend.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -32,6 +32,8 @@ * */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/cache_ban.c =================================================================== --- branches/1.2/bin/varnishd/cache_ban.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_ban.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * Ban processing */ +#include "config.h" + #include #include Modified: branches/1.2/bin/varnishd/cache_center.c =================================================================== --- branches/1.2/bin/varnishd/cache_center.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_center.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -56,6 +56,8 @@ DOT acceptor -> start [style=bold,color=green,weight=4] */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/cache_cli.c =================================================================== --- branches/1.2/bin/varnishd/cache_cli.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_cli.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/cache_expire.c =================================================================== --- branches/1.2/bin/varnishd/cache_expire.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_expire.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -38,6 +38,8 @@ * XXX: are ready. */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/cache_fetch.c =================================================================== --- branches/1.2/bin/varnishd/cache_fetch.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_fetch.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/cache_hash.c =================================================================== --- branches/1.2/bin/varnishd/cache_hash.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_hash.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -52,6 +52,8 @@ * not busy only once. */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/cache_http.c =================================================================== --- branches/1.2/bin/varnishd/cache_http.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_http.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * HTTP request storage and manipulation */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/cache_httpconn.c =================================================================== --- branches/1.2/bin/varnishd/cache_httpconn.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_httpconn.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * HTTP protocol requests */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/cache_main.c =================================================================== --- branches/1.2/bin/varnishd/cache_main.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_main.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/cache_panic.c =================================================================== --- branches/1.2/bin/varnishd/cache_panic.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_panic.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/cache_pipe.c =================================================================== --- branches/1.2/bin/varnishd/cache_pipe.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_pipe.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * XXX: charge bytes to srcaddr */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/cache_pool.c =================================================================== --- branches/1.2/bin/varnishd/cache_pool.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_pool.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * XXX: automatic thread-pool size adaptation. */ +#include "config.h" + #include #include Modified: branches/1.2/bin/varnishd/cache_response.c =================================================================== --- branches/1.2/bin/varnishd/cache_response.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_response.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.2/bin/varnishd/cache_session.c =================================================================== --- branches/1.2/bin/varnishd/cache_session.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_session.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -48,6 +48,8 @@ * XXX: we still have to do the source-addr lookup. */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/cache_synthetic.c =================================================================== --- branches/1.2/bin/varnishd/cache_synthetic.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_synthetic.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -28,6 +28,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.2/bin/varnishd/cache_vary.c =================================================================== --- branches/1.2/bin/varnishd/cache_vary.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_vary.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -54,6 +54,8 @@ * '\0' */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/cache_vcl.c =================================================================== --- branches/1.2/bin/varnishd/cache_vcl.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_vcl.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -33,6 +33,8 @@ * The interface *from* the compiled VCL code is in cache_vrt.c. */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/cache_vrt.c =================================================================== --- branches/1.2/bin/varnishd/cache_vrt.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_vrt.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * Runtime support for compiled VCL programs */ +#include "config.h" + #include #include Modified: branches/1.2/bin/varnishd/cache_vrt_acl.c =================================================================== --- branches/1.2/bin/varnishd/cache_vrt_acl.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_vrt_acl.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -34,6 +34,8 @@ * XXX: a refresh facility. */ +#include "config.h" + #include #include Modified: branches/1.2/bin/varnishd/cache_vrt_esi.c =================================================================== --- branches/1.2/bin/varnishd/cache_vrt_esi.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_vrt_esi.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * Runtime support for compiled VCL programs */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/cache_vrt_re.c =================================================================== --- branches/1.2/bin/varnishd/cache_vrt_re.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_vrt_re.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * Runtime support for compiled VCL programs, regexps */ +#include "config.h" + #include #include Modified: branches/1.2/bin/varnishd/cache_ws.c =================================================================== --- branches/1.2/bin/varnishd/cache_ws.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/cache_ws.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -30,6 +30,8 @@ * */ +#include "config.h" + #include #include Modified: branches/1.2/bin/varnishd/hash_classic.c =================================================================== --- branches/1.2/bin/varnishd/hash_classic.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/hash_classic.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * A classic bucketed hash */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/hash_simple_list.c =================================================================== --- branches/1.2/bin/varnishd/hash_simple_list.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/hash_simple_list.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * This is the reference hash(/lookup) implementation */ +#include "config.h" + #include #include Modified: branches/1.2/bin/varnishd/mgt_child.c =================================================================== --- branches/1.2/bin/varnishd/mgt_child.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/mgt_child.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * The mechanics of handling the child process */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/mgt_cli.c =================================================================== --- branches/1.2/bin/varnishd/mgt_cli.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/mgt_cli.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * The management process' CLI handling */ +#include "config.h" + #include #include Modified: branches/1.2/bin/varnishd/mgt_event.c =================================================================== --- branches/1.2/bin/varnishd/mgt_event.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/mgt_event.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/mgt_param.c =================================================================== --- branches/1.2/bin/varnishd/mgt_param.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/mgt_param.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.2/bin/varnishd/mgt_vcc.c =================================================================== --- branches/1.2/bin/varnishd/mgt_vcc.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/mgt_vcc.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * VCL compiler stuff */ +#include "config.h" + #include #include Modified: branches/1.2/bin/varnishd/rfc2616.c =================================================================== --- branches/1.2/bin/varnishd/rfc2616.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/rfc2616.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.2/bin/varnishd/shmlog.c =================================================================== --- branches/1.2/bin/varnishd/shmlog.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/shmlog.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/stevedore.c =================================================================== --- branches/1.2/bin/varnishd/stevedore.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/stevedore.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -28,6 +28,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/storage_file.c =================================================================== --- branches/1.2/bin/varnishd/storage_file.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/storage_file.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * Storage method based on mmap'ed file */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishd/storage_malloc.c =================================================================== --- branches/1.2/bin/varnishd/storage_malloc.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/storage_malloc.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * Storage method based on malloc(3) */ +#include "config.h" + #include #include Modified: branches/1.2/bin/varnishd/tcp.c =================================================================== --- branches/1.2/bin/varnishd/tcp.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/tcp.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.2/bin/varnishd/varnishd.c =================================================================== --- branches/1.2/bin/varnishd/varnishd.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishd/varnishd.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * The management process and CLI handling */ +#include "config.h" + #include #include Modified: branches/1.2/bin/varnishhist/Makefile.am =================================================================== --- branches/1.2/bin/varnishhist/Makefile.am 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishhist/Makefile.am 2008-03-08 13:38:23 UTC (rev 2564) @@ -8,8 +8,6 @@ varnishhist_SOURCES = varnishhist.c -varnishhist_CFLAGS = -include config.h - varnishhist_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ Modified: branches/1.2/bin/varnishhist/varnishhist.c =================================================================== --- branches/1.2/bin/varnishhist/varnishhist.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishhist/varnishhist.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -32,6 +32,8 @@ * Log tailer for Varnish */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishlog/Makefile.am =================================================================== --- branches/1.2/bin/varnishlog/Makefile.am 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishlog/Makefile.am 2008-03-08 13:38:23 UTC (rev 2564) @@ -8,8 +8,6 @@ varnishlog_SOURCES = varnishlog.c -varnishlog_CFLAGS = -include config.h - varnishlog_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ Modified: branches/1.2/bin/varnishlog/varnishlog.c =================================================================== --- branches/1.2/bin/varnishlog/varnishlog.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishlog/varnishlog.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * Log tailer for Varnish */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishncsa/Makefile.am =================================================================== --- branches/1.2/bin/varnishncsa/Makefile.am 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishncsa/Makefile.am 2008-03-08 13:38:23 UTC (rev 2564) @@ -8,8 +8,6 @@ varnishncsa_SOURCES = varnishncsa.c -varnishncsa_CFLAGS = -include config.h - varnishncsa_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ Modified: branches/1.2/bin/varnishncsa/varnishncsa.c =================================================================== --- branches/1.2/bin/varnishncsa/varnishncsa.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishncsa/varnishncsa.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -59,6 +59,8 @@ * - Maybe rotate/compress log */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishreplay/Makefile.am =================================================================== --- branches/1.2/bin/varnishreplay/Makefile.am 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishreplay/Makefile.am 2008-03-08 13:38:23 UTC (rev 2564) @@ -8,8 +8,6 @@ varnishreplay_SOURCES = \ varnishreplay.c - -varnishreplay_CFLAGS = -include config.h varnishreplay_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ Modified: branches/1.2/bin/varnishreplay/varnishreplay.c =================================================================== --- branches/1.2/bin/varnishreplay/varnishreplay.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishreplay/varnishreplay.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -28,6 +28,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: branches/1.2/bin/varnishstat/Makefile.am =================================================================== --- branches/1.2/bin/varnishstat/Makefile.am 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishstat/Makefile.am 2008-03-08 13:38:23 UTC (rev 2564) @@ -8,8 +8,6 @@ varnishstat_SOURCES = varnishstat.c -varnishstat_CFLAGS = -include config.h - varnishstat_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ Modified: branches/1.2/bin/varnishstat/varnishstat.c =================================================================== --- branches/1.2/bin/varnishstat/varnishstat.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishstat/varnishstat.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -32,6 +32,8 @@ * Log tailer for Varnish */ +#include "config.h" + #include #include Modified: branches/1.2/bin/varnishtop/Makefile.am =================================================================== --- branches/1.2/bin/varnishtop/Makefile.am 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishtop/Makefile.am 2008-03-08 13:38:23 UTC (rev 2564) @@ -8,8 +8,6 @@ varnishtop_SOURCES = varnishtop.c -varnishtop_CFLAGS = -include config.h - varnishtop_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ Modified: branches/1.2/bin/varnishtop/varnishtop.c =================================================================== --- branches/1.2/bin/varnishtop/varnishtop.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/bin/varnishtop/varnishtop.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -32,6 +32,8 @@ * Log tailer for Varnish */ +#include "config.h" + #include #include #include Modified: branches/1.2/configure.ac =================================================================== --- branches/1.2/configure.ac 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/configure.ac 2008-03-08 13:38:23 UTC (rev 2564) @@ -38,10 +38,15 @@ save_LIBS="${LIBS}" LIBS="" -AC_SEARCH_LIBS(initscr, [curses ncurses]) +AC_SEARCH_LIBS(initscr, [curses ncurses], + [have_curses=yes], [have_curses=no]) CURSES_LIBS="${LIBS}" LIBS="${save_LIBS}" AC_SUBST(CURSES_LIBS) +if test "$have_curses" = no; then + AC_MSG_WARN([curses not found; some tools will not be built]) +fi +AM_CONDITIONAL([HAVE_CURSES], [test x$have_curses = xyes]) save_LIBS="${LIBS}" LIBS="" @@ -182,6 +187,11 @@ AC_ARG_ENABLE(stack-protector, AS_HELP_STRING([--enable-stack-protector],[enable stack protector (default is NO)]), CFLAGS="${CFLAGS} -fstack-protector-all") + +AC_ARG_ENABLE(tests, + AS_HELP_STRING([--enable-tests],[build test programs (default is NO)])) +AM_CONDITIONAL([ENABLE_TESTS], [test x$enable_tests = xyes]) + AC_ARG_ENABLE(werror, AS_HELP_STRING([--enable-werror],[use -Werror (default is NO)]), CFLAGS="${CFLAGS} -Werror") Modified: branches/1.2/include/binary_heap.h =================================================================== --- branches/1.2/include/binary_heap.h 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/include/binary_heap.h 2008-03-08 13:38:23 UTC (rev 2564) @@ -69,7 +69,7 @@ * The root item has 'idx' zero */ -void *binheap_root(struct binheap *); +void *binheap_root(const struct binheap *); /* * Return the root item */ Modified: branches/1.2/lib/libvarnish/Makefile.am =================================================================== --- branches/1.2/lib/libvarnish/Makefile.am 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnish/Makefile.am 2008-03-08 13:38:23 UTC (rev 2564) @@ -19,6 +19,17 @@ vss.c \ vtmpfile.c -libvarnish_la_CFLAGS = -include config.h +libvarnish_la_LIBADD = ${RT_LIBS} ${NET_LIBS} ${LIBM} -libvarnish_la_LIBADD = ${RT_LIBS} ${NET_LIBS} +TESTS = num_c_test + +if ENABLE_TESTS +noinst_PROGRAMS = ${TESTS} + +num_c_test_SOURCES = num.c +num_c_test_CFLAGS = -DNUM_C_TEST -include config.h +num_c_test_LDADD = ${LIBM} + +test: ${TESTS} + @for test in ${TESTS} ; do ./$${test} ; done +endif Modified: branches/1.2/lib/libvarnish/argv.c =================================================================== --- branches/1.2/lib/libvarnish/argv.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnish/argv.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -38,6 +38,8 @@ * */ +#include "config.h" + #include #include #include Modified: branches/1.2/lib/libvarnish/assert.c =================================================================== --- branches/1.2/lib/libvarnish/assert.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnish/assert.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: branches/1.2/lib/libvarnish/binary_heap.c =================================================================== --- branches/1.2/lib/libvarnish/binary_heap.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnish/binary_heap.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -36,11 +36,13 @@ * XXX: the array is not scaled back when items are deleted. */ -#include +#include "config.h" + #include #include #include "binary_heap.h" +#include "libvarnish.h" /* Private definitions -----------------------------------------------*/ @@ -186,7 +188,7 @@ } void * -binheap_root(struct binheap *bh) +binheap_root(const struct binheap *bh) { assert(bh != NULL); Modified: branches/1.2/lib/libvarnish/cli.c =================================================================== --- branches/1.2/lib/libvarnish/cli.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnish/cli.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * Stuff for handling the CLI protocol */ +#include "config.h" + #include #include #include Modified: branches/1.2/lib/libvarnish/cli_common.c =================================================================== --- branches/1.2/lib/libvarnish/cli_common.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnish/cli_common.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.2/lib/libvarnish/crc32.c =================================================================== --- branches/1.2/lib/libvarnish/crc32.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnish/crc32.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * This CRC32 implementation is in the public domain. */ +#include "config.h" + #include "libvarnish.h" /*--------------------------------------------------------------------*/ Modified: branches/1.2/lib/libvarnish/flopen.c =================================================================== --- branches/1.2/lib/libvarnish/flopen.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnish/flopen.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $FreeBSD: src/lib/libutil/flopen.c,v 1.7 2007/05/23 12:09:33 des Exp $ */ +#include "config.h" + #include #include Modified: branches/1.2/lib/libvarnish/time.c =================================================================== --- branches/1.2/lib/libvarnish/time.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnish/time.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -46,6 +46,8 @@ * */ +#include "config.h" + #include #include Modified: branches/1.2/lib/libvarnish/version.c =================================================================== --- branches/1.2/lib/libvarnish/version.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnish/version.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * Display a standardized version message. */ +#include "config.h" + #include #include "libvarnish.h" Modified: branches/1.2/lib/libvarnish/vpf.c =================================================================== --- branches/1.2/lib/libvarnish/vpf.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnish/vpf.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -28,6 +28,8 @@ * $FreeBSD: src/lib/libutil/pidfile.c,v 1.5 2007/05/11 11:10:05 des Exp $ */ +#include "config.h" + #include #include #include Modified: branches/1.2/lib/libvarnish/vsb.c =================================================================== --- branches/1.2/lib/libvarnish/vsb.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnish/vsb.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $FreeBSD: src/sys/kern/subr_sbuf.c,v 1.30 2005/12/23 11:49:53 phk Exp $ */ +#include "config.h" + #include #include #include Modified: branches/1.2/lib/libvarnish/vss.c =================================================================== --- branches/1.2/lib/libvarnish/vss.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnish/vss.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -30,6 +30,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.2/lib/libvarnish/vtmpfile.c =================================================================== --- branches/1.2/lib/libvarnish/vtmpfile.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnish/vtmpfile.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: branches/1.2/lib/libvarnishapi/Makefile.am =================================================================== --- branches/1.2/lib/libvarnishapi/Makefile.am 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnishapi/Makefile.am 2008-03-08 13:38:23 UTC (rev 2564) @@ -9,5 +9,5 @@ instance.c \ shmlog.c -libvarnishapi_la_CFLAGS = -include config.h \ +libvarnishapi_la_CFLAGS = \ -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' Modified: branches/1.2/lib/libvarnishapi/base64.c =================================================================== --- branches/1.2/lib/libvarnishapi/base64.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnishapi/base64.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -6,6 +6,8 @@ * $Id$ */ +#include "config.h" + #include #include #include "varnishapi.h" Modified: branches/1.2/lib/libvarnishapi/instance.c =================================================================== --- branches/1.2/lib/libvarnishapi/instance.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnishapi/instance.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -28,6 +28,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: branches/1.2/lib/libvarnishapi/shmlog.c =================================================================== --- branches/1.2/lib/libvarnishapi/shmlog.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnishapi/shmlog.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,9 @@ * $Id$ */ +#include "config.h" + +#include #include #include Modified: branches/1.2/lib/libvarnishcompat/Makefile.am =================================================================== --- branches/1.2/lib/libvarnishcompat/Makefile.am 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnishcompat/Makefile.am 2008-03-08 13:38:23 UTC (rev 2564) @@ -14,5 +14,3 @@ strlcpy.c \ strndup.c \ vis.c - -libvarnishcompat_la_CFLAGS = -include config.h Modified: branches/1.2/lib/libvarnishcompat/asprintf.c =================================================================== --- branches/1.2/lib/libvarnishcompat/asprintf.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnishcompat/asprintf.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -30,6 +30,8 @@ * */ +#include "config.h" + #ifndef HAVE_ASPRINTF #include Modified: branches/1.2/lib/libvarnishcompat/daemon.c =================================================================== --- branches/1.2/lib/libvarnishcompat/daemon.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnishcompat/daemon.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * $FreeBSD: src/lib/libc/gen/daemon.c,v 1.8 2007/01/09 00:27:53 imp Exp $ */ +#include "config.h" + #ifndef HAVE_DAEMON #include Modified: branches/1.2/lib/libvarnishcompat/setproctitle.c =================================================================== --- branches/1.2/lib/libvarnishcompat/setproctitle.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnishcompat/setproctitle.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #ifndef HAVE_SETPROCTITLE #include Modified: branches/1.2/lib/libvarnishcompat/srandomdev.c =================================================================== --- branches/1.2/lib/libvarnishcompat/srandomdev.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnishcompat/srandomdev.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #ifndef HAVE_SRANDOMDEV #include Modified: branches/1.2/lib/libvarnishcompat/strlcat.c =================================================================== --- branches/1.2/lib/libvarnishcompat/strlcat.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnishcompat/strlcat.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -17,6 +17,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" + #ifndef HAVE_STRLCAT #include Modified: branches/1.2/lib/libvarnishcompat/strlcpy.c =================================================================== --- branches/1.2/lib/libvarnishcompat/strlcpy.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnishcompat/strlcpy.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -17,6 +17,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" + #ifndef HAVE_STRLCPY #include Modified: branches/1.2/lib/libvarnishcompat/strndup.c =================================================================== --- branches/1.2/lib/libvarnishcompat/strndup.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnishcompat/strndup.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -30,6 +30,8 @@ * */ +#include "config.h" + #ifndef HAVE_STRNDUP #include Modified: branches/1.2/lib/libvarnishcompat/vasprintf.c =================================================================== --- branches/1.2/lib/libvarnishcompat/vasprintf.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnishcompat/vasprintf.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -30,6 +30,8 @@ * */ +#include "config.h" + #ifndef HAVE_VASPRINTF #include Modified: branches/1.2/lib/libvarnishcompat/vis.c =================================================================== --- branches/1.2/lib/libvarnishcompat/vis.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvarnishcompat/vis.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -31,6 +31,8 @@ * $Id$ */ +#include "config.h" + #if !defined(HAVE_VIS) || !defined(HAVE_STRVIS) || !defined(HAVE_STRVISX) #include Modified: branches/1.2/lib/libvcl/Makefile.am =================================================================== --- branches/1.2/lib/libvcl/Makefile.am 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvcl/Makefile.am 2008-03-08 13:38:23 UTC (rev 2564) @@ -20,5 +20,3 @@ vcc_token.c \ vcc_var.c \ vcc_xref.c - -libvcl_la_CFLAGS = -include config.h Modified: branches/1.2/lib/libvcl/vcc_acl.c =================================================================== --- branches/1.2/lib/libvcl/vcc_acl.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvcl/vcc_acl.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.2/lib/libvcl/vcc_action.c =================================================================== --- branches/1.2/lib/libvcl/vcc_action.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvcl/vcc_action.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include "vsb.h" Modified: branches/1.2/lib/libvcl/vcc_backend.c =================================================================== --- branches/1.2/lib/libvcl/vcc_backend.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvcl/vcc_backend.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.2/lib/libvcl/vcc_compile.c =================================================================== --- branches/1.2/lib/libvcl/vcc_compile.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvcl/vcc_compile.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -60,6 +60,8 @@ * and all the rest... */ +#include "config.h" + #include #include Modified: branches/1.2/lib/libvcl/vcc_fixed_token.c =================================================================== --- branches/1.2/lib/libvcl/vcc_fixed_token.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvcl/vcc_fixed_token.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -6,6 +6,7 @@ * Edit vcc_gen_fixed_token.tcl instead */ +#include "config.h" #include #include #include "vcc_priv.h" Modified: branches/1.2/lib/libvcl/vcc_gen_fixed_token.tcl =================================================================== --- branches/1.2/lib/libvcl/vcc_gen_fixed_token.tcl 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvcl/vcc_gen_fixed_token.tcl 2008-03-08 13:38:23 UTC (rev 2564) @@ -220,6 +220,7 @@ set foh [open "vcc_token_defs.h" w] warns $foh +puts $fo "#include \"config.h\"" puts $fo "#include " puts $fo "#include " puts $fo "#include \"vcc_priv.h\"" Modified: branches/1.2/lib/libvcl/vcc_gen_obj.tcl =================================================================== --- branches/1.2/lib/libvcl/vcc_gen_obj.tcl 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvcl/vcc_gen_obj.tcl 2008-03-08 13:38:23 UTC (rev 2564) @@ -296,6 +296,7 @@ puts $fo "\t{ NULL }" } +puts $fo "#include \"config.h\"" puts $fo "#include " puts $fo "#include \"vcc_compile.h\"" puts $fo "" Modified: branches/1.2/lib/libvcl/vcc_obj.c =================================================================== --- branches/1.2/lib/libvcl/vcc_obj.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvcl/vcc_obj.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -6,6 +6,7 @@ * Edit vcc_gen_obj.tcl instead */ +#include "config.h" #include #include "vcc_compile.h" Modified: branches/1.2/lib/libvcl/vcc_parse.c =================================================================== --- branches/1.2/lib/libvcl/vcc_parse.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvcl/vcc_parse.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.2/lib/libvcl/vcc_string.c =================================================================== --- branches/1.2/lib/libvcl/vcc_string.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvcl/vcc_string.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.2/lib/libvcl/vcc_token.c =================================================================== --- branches/1.2/lib/libvcl/vcc_token.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvcl/vcc_token.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: branches/1.2/lib/libvcl/vcc_var.c =================================================================== --- branches/1.2/lib/libvcl/vcc_var.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvcl/vcc_var.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.2/lib/libvcl/vcc_xref.c =================================================================== --- branches/1.2/lib/libvcl/vcc_xref.c 2008-03-08 13:12:02 UTC (rev 2563) +++ branches/1.2/lib/libvcl/vcc_xref.c 2008-03-08 13:38:23 UTC (rev 2564) @@ -39,6 +39,8 @@ * they are called. */ +#include "config.h" + #include #include "vsb.h" From des at projects.linpro.no Sat Mar 8 13:47:56 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sat, 8 Mar 2008 14:47:56 +0100 (CET) Subject: r2565 - trunk/varnish-cache/bin/varnishd Message-ID: <20080308134756.DF5151EC0B7@projects.linpro.no> Author: des Date: 2008-03-08 14:47:56 +0100 (Sat, 08 Mar 2008) New Revision: 2565 Modified: trunk/varnish-cache/bin/varnishd/varnishd.1 Log: dump.pool was removed a while ago. Modified: trunk/varnish-cache/bin/varnishd/varnishd.1 =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.1 2008-03-08 13:38:23 UTC (rev 2564) +++ trunk/varnish-cache/bin/varnishd/varnishd.1 2008-03-08 13:47:56 UTC (rev 2565) @@ -28,7 +28,7 @@ .\" .\" $Id$ .\" -.Dd July 20, 2007 +.Dd March 8, 2008 .Dt VARNISHD 1 .Os .Sh NAME @@ -295,7 +295,6 @@ address and port. The following commands are available: .Bl -tag -width 4n -.It Cm dump.pool .It Cm help Display a list of available commands. .It Cm param.set Ar param Ar value From des at projects.linpro.no Sat Mar 8 13:51:54 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sat, 8 Mar 2008 14:51:54 +0100 (CET) Subject: r2566 - branches/1.2 Message-ID: <20080308135154.3E0251EC4D5@projects.linpro.no> Author: des Date: 2008-03-08 14:51:54 +0100 (Sat, 08 Mar 2008) New Revision: 2566 Modified: branches/1.2/ branches/1.2/configure.ac Log: Merged revisions 2322-2323,2325-2327,2337,2358,2362-2364,2366,2374,2376-2378,2380-2382 via svnmerge from svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache ........ r2322 | des | 2007-12-20 14:35:33 +0100 (Thu, 20 Dec 2007) | 2 lines Only look for sendfile() on platforms where we know how to use it. ........ r2337 | phk | 2008-01-08 15:35:09 +0100 (Tue, 08 Jan 2008) | 4 lines Don't even look for senfile, it doesn't work for what we need on any of the platforms right now. ........ r2382 | des | 2008-01-23 21:23:20 +0100 (Wed, 23 Jan 2008) | 13 lines Improve readability, such as it is. Allow the user to disable specific acceptor mechanisms (e.g. do not use epoll even though it is available). Don't look for kqueue on systems where we know it doesn't work. Bail if no acceptor mechanism was found. Bail if no curses or ncurses was found. Warn the user if SO_{RCV,SND}TIMEO are non-functional. ........ + part of r2456 which was left out in previous merge. Property changes on: branches/1.2 ___________________________________________________________________ Name: svnmerge-integrated - /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317,2319,2321,2323-2327,2358,2362-2364,2366,2374-2381,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2492-2494,2500-2502 + /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317,2319,2321-2327,2337,2358,2362-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2492-2494,2500-2502 Modified: branches/1.2/configure.ac =================================================================== --- branches/1.2/configure.ac 2008-03-08 13:47:56 UTC (rev 2565) +++ branches/1.2/configure.ac 2008-03-08 13:51:54 UTC (rev 2566) @@ -97,9 +97,21 @@ AC_FUNC_STRERROR_R AC_CHECK_FUNCS([socket]) AC_CHECK_FUNCS([strptime]) -AC_CHECK_FUNCS([sendfile]) AC_CHECK_FUNCS([fmtcheck]) +# Don't look for sendfile at all, none of them work +# anyway. (don't tell when done with passed mem-range) +# +## This one is tricky, there are multiple versions +#case $host in +#*-*-freebsd*|*-*-linux*) +# AC_CHECK_FUNCS([sendfile]) +# ;; +#*) +# AC_MSG_WARN([won't look for sendfile() on $host]) +# ;; +#esac + # These functions are provided by libcompat on platforms where they # are not available AC_CHECK_FUNCS([asprintf vasprintf]) @@ -115,12 +127,71 @@ AC_CHECK_FUNCS([clock_gettime]) LIBS="${save_LIBS}" -# Check which mechanism to use for the acceptor -AC_CHECK_FUNCS([kqueue]) -AC_CHECK_FUNCS([epoll_ctl]) -AC_CHECK_FUNCS([poll]) +# Check which mechanism to use for the acceptor. We look for kqueue +# only on platforms on which we know that it works, because there are +# platforms where a simple AC_CHECK_FUNCS([kqueue]) would succeed but +# the build would fail. We also allow the user to disable mechanisms +# he doesn't want to use. -# Solaris defines SO_{RCV,SND}TIMEO, but does not implement them +# --enable-kqueue +AC_ARG_ENABLE(kqueue, + AS_HELP_STRING([--enable-kqueue], + [use kqueue if available (default is YES)]), + , + [enable_kqueue=yes]) + +if test "$enable_kqueue" = yes; then + case $host in + *-*-freebsd*) + AC_CHECK_FUNCS([kqueue]) + ;; + *-*-bsd*) + # No other BSD has a sufficiently recent implementation + AC_MSG_WARN([won't look for kqueue() on $host]) + ac_cv_func_kqueue=no + ;; + esac +else + ac_cv_func_kqueue=no +fi + +# --enable-epoll +AC_ARG_ENABLE(epoll, + AS_HELP_STRING([--enable-epoll], + [use epoll if available (default is YES)]), + , + [enable_epoll=yes]) + +if test "$enable_epoll" = yes; then + AC_CHECK_FUNCS([epoll_ctl]) +else + ac_cv_func_epoll_ctl=no +fi + +# --enable-poll +AC_ARG_ENABLE(poll, + AS_HELP_STRING([--enable-poll], + [use poll if available (default is YES)]), + , + [enable_poll=yes]) + +if test "$enable_poll" = yes; then + AC_CHECK_FUNCS([poll]) +else + ac_cv_func_poll=no +fi + +if test "$ac_cv_func_kqueue" != yes && + test "$ac_cv_func_epoll_ctl" != yes && + test "$ac_cv_func_poll" != yes; then + AC_MSG_ERROR([no usable acceptor mechanism]) +fi + +# Solaris defines SO_{RCV,SND}TIMEO, but does not implement them. +# Varnish will build and run without these, but connections will not +# time out, which may leave Varnish vulnerable to denail-of-service +# attacks which would not be possible on other platforms. + AC_CACHE_CHECK([whether SO_RCVTIMEO works], [ac_cv_so_rcvtimeo_works], [AC_RUN_IFELSE( @@ -159,6 +230,11 @@ AC_DEFINE([SO_SNDTIMEO_WORKS], [1], [Define if SO_SNDTIMEO works]) fi +if test "$ac_cv_so_rcvtimeo_works" = no || + test "$ac_cv_so_sndtimeo_works" = no; then + AC_MSG_WARN([connection timeouts will not work]) +fi + # Run-time directory VARNISH_STATE_DIR='${localstatedir}/varnish' AC_SUBST(VARNISH_STATE_DIR) @@ -172,26 +248,37 @@ # Additional flags for GCC 4 EXTRA_DEVELOPER_CFLAGS="-Wextra -Wno-missing-field-initializers -Wno-sign-compare" +# --enable-developer-warnings AC_ARG_ENABLE(developer-warnings, AS_HELP_STRING([--enable-developer-warnings],[enable strict warnings (default is NO)]), CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}") + +# --enable-debugging-symbols AC_ARG_ENABLE(debugging-symbols, AS_HELP_STRING([--enable-debugging-symbols],[enable debugging symbols (default is NO)]), CFLAGS="${CFLAGS} -O0 -g -fno-inline") + +# --enable-diagnostics AC_ARG_ENABLE(diagnostics, AS_HELP_STRING([--enable-diagnostics],[enable run-time diagnostics (default is NO)]), CFLAGS="${CFLAGS} -DDIAGNOSTICS") + +# --enable-extra-developer-warnings AC_ARG_ENABLE(extra-developer-warnings, AS_HELP_STRING([--enable-extra-developer-warnings],[enable even stricter warnings (default is NO)]), CFLAGS="${CFLAGS} ${EXTRA_DEVELOPER_CFLAGS}") + +# --enable-stack-protector AC_ARG_ENABLE(stack-protector, AS_HELP_STRING([--enable-stack-protector],[enable stack protector (default is NO)]), CFLAGS="${CFLAGS} -fstack-protector-all") +# --enable-tests AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests],[build test programs (default is NO)])) AM_CONDITIONAL([ENABLE_TESTS], [test x$enable_tests = xyes]) +# --enable-werror AC_ARG_ENABLE(werror, AS_HELP_STRING([--enable-werror],[use -Werror (default is NO)]), CFLAGS="${CFLAGS} -Werror") From des at projects.linpro.no Sat Mar 8 14:01:29 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sat, 8 Mar 2008 15:01:29 +0100 (CET) Subject: r2567 - in branches/1.2: . bin/varnishd Message-ID: <20080308140129.24C841EC433@projects.linpro.no> Author: des Date: 2008-03-08 15:01:28 +0100 (Sat, 08 Mar 2008) New Revision: 2567 Modified: branches/1.2/ branches/1.2/bin/varnishd/cache_cli.c branches/1.2/bin/varnishd/cache_pool.c branches/1.2/bin/varnishd/varnishd.1 Log: Merged revisions 2467,2495-2499,2503-2505,2522-2524,2545,2563-2565 via svnmerge from svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache ........ r2467 | phk | 2008-02-15 11:01:19 +0100 (Fri, 15 Feb 2008) | 2 lines remove the undocumented and unimplemented dump.pool command ........ r2565 | des | 2008-03-08 14:47:56 +0100 (Sat, 08 Mar 2008) | 2 lines dump.pool was removed a while ago. ........ Property changes on: branches/1.2 ___________________________________________________________________ Name: svnmerge-integrated - /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317,2319,2321-2327,2337,2358,2362-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2492-2494,2500-2502 + /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317,2319,2321-2327,2337,2358,2362-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2522-2524,2545,2563-2565 Modified: branches/1.2/bin/varnishd/cache_cli.c =================================================================== --- branches/1.2/bin/varnishd/cache_cli.c 2008-03-08 13:51:54 UTC (rev 2566) +++ branches/1.2/bin/varnishd/cache_cli.c 2008-03-08 14:01:28 UTC (rev 2567) @@ -75,10 +75,6 @@ { CLI_VCL_DISCARD, cli_func_config_discard }, { CLI_VCL_USE, cli_func_config_use }, - /* Undocumented */ - { "dump.pool", "dump.pool", - "\tDump the worker thread pool state\n", - 0, 0, cli_func_dump_pool }, { NULL } }; Modified: branches/1.2/bin/varnishd/cache_pool.c =================================================================== --- branches/1.2/bin/varnishd/cache_pool.c 2008-03-08 13:51:54 UTC (rev 2566) +++ branches/1.2/bin/varnishd/cache_pool.c 2008-03-08 14:01:28 UTC (rev 2567) @@ -433,14 +433,3 @@ AZ(pthread_create(&tp, NULL, wrk_reaperthread, NULL)); AZ(pthread_detach(tp)); } - -/*--------------------------------------------------------------------*/ - -void -cli_func_dump_pool(struct cli *cli, const char * const *av, void *priv) -{ - - (void)cli; - (void)av; - (void)priv; -} Modified: branches/1.2/bin/varnishd/varnishd.1 =================================================================== --- branches/1.2/bin/varnishd/varnishd.1 2008-03-08 13:51:54 UTC (rev 2566) +++ branches/1.2/bin/varnishd/varnishd.1 2008-03-08 14:01:28 UTC (rev 2567) @@ -28,7 +28,7 @@ .\" .\" $Id$ .\" -.Dd July 20, 2007 +.Dd March 8, 2008 .Dt VARNISHD 1 .Os .Sh NAME @@ -285,7 +285,6 @@ address and port. The following commands are available: .Bl -tag -width 4n -.It Cm dump.pool .It Cm help Display a list of available commands. .It Cm param.set Ar param Ar value From des at projects.linpro.no Sat Mar 8 14:12:52 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sat, 8 Mar 2008 15:12:52 +0100 (CET) Subject: r2568 - in branches/1.1: . bin bin/varnishadm bin/varnishd bin/varnishhist bin/varnishlog bin/varnishncsa bin/varnishreplay bin/varnishstat bin/varnishtop include lib/libvarnish lib/libvarnishapi lib/libvarnishcompat lib/libvcl Message-ID: <20080308141252.8937B1EC4D5@projects.linpro.no> Author: des Date: 2008-03-08 15:12:52 +0100 (Sat, 08 Mar 2008) New Revision: 2568 Modified: branches/1.1/ branches/1.1/autogen.des branches/1.1/bin/Makefile.am branches/1.1/bin/varnishadm/Makefile.am branches/1.1/bin/varnishadm/varnishadm.c branches/1.1/bin/varnishd/Makefile.am branches/1.1/bin/varnishd/cache_acceptor.c branches/1.1/bin/varnishd/cache_acceptor_epoll.c branches/1.1/bin/varnishd/cache_acceptor_kqueue.c branches/1.1/bin/varnishd/cache_acceptor_poll.c branches/1.1/bin/varnishd/cache_backend.c branches/1.1/bin/varnishd/cache_ban.c branches/1.1/bin/varnishd/cache_center.c branches/1.1/bin/varnishd/cache_cli.c branches/1.1/bin/varnishd/cache_expire.c branches/1.1/bin/varnishd/cache_fetch.c branches/1.1/bin/varnishd/cache_hash.c branches/1.1/bin/varnishd/cache_http.c branches/1.1/bin/varnishd/cache_main.c branches/1.1/bin/varnishd/cache_pipe.c branches/1.1/bin/varnishd/cache_pool.c branches/1.1/bin/varnishd/cache_response.c branches/1.1/bin/varnishd/cache_session.c branches/1.1/bin/varnishd/cache_synthetic.c branches/1.1/bin/varnishd/cache_vary.c branches/1.1/bin/varnishd/cache_vcl.c branches/1.1/bin/varnishd/cache_vrt.c branches/1.1/bin/varnishd/cache_vrt_acl.c branches/1.1/bin/varnishd/cache_vrt_re.c branches/1.1/bin/varnishd/cache_ws.c branches/1.1/bin/varnishd/hash_classic.c branches/1.1/bin/varnishd/hash_simple_list.c branches/1.1/bin/varnishd/mgt_child.c branches/1.1/bin/varnishd/mgt_cli.c branches/1.1/bin/varnishd/mgt_event.c branches/1.1/bin/varnishd/mgt_param.c branches/1.1/bin/varnishd/mgt_vcc.c branches/1.1/bin/varnishd/rfc2616.c branches/1.1/bin/varnishd/shmlog.c branches/1.1/bin/varnishd/stevedore.c branches/1.1/bin/varnishd/storage_file.c branches/1.1/bin/varnishd/storage_malloc.c branches/1.1/bin/varnishd/tcp.c branches/1.1/bin/varnishd/varnishd.1 branches/1.1/bin/varnishd/varnishd.c branches/1.1/bin/varnishhist/Makefile.am branches/1.1/bin/varnishhist/varnishhist.c branches/1.1/bin/varnishlog/Makefile.am branches/1.1/bin/varnishlog/varnishlog.c branches/1.1/bin/varnishncsa/Makefile.am branches/1.1/bin/varnishncsa/varnishncsa.c branches/1.1/bin/varnishreplay/Makefile.am branches/1.1/bin/varnishreplay/varnishreplay.c branches/1.1/bin/varnishstat/Makefile.am branches/1.1/bin/varnishstat/varnishstat.c branches/1.1/bin/varnishtop/Makefile.am branches/1.1/bin/varnishtop/varnishtop.c branches/1.1/configure.ac branches/1.1/include/binary_heap.h branches/1.1/lib/libvarnish/Makefile.am branches/1.1/lib/libvarnish/argv.c branches/1.1/lib/libvarnish/assert.c branches/1.1/lib/libvarnish/binary_heap.c branches/1.1/lib/libvarnish/cli.c branches/1.1/lib/libvarnish/cli_common.c branches/1.1/lib/libvarnish/crc32.c branches/1.1/lib/libvarnish/flopen.c branches/1.1/lib/libvarnish/time.c branches/1.1/lib/libvarnish/version.c branches/1.1/lib/libvarnish/vpf.c branches/1.1/lib/libvarnish/vsb.c branches/1.1/lib/libvarnish/vss.c branches/1.1/lib/libvarnishapi/Makefile.am branches/1.1/lib/libvarnishapi/base64.c branches/1.1/lib/libvarnishapi/instance.c branches/1.1/lib/libvarnishapi/shmlog.c branches/1.1/lib/libvarnishcompat/Makefile.am branches/1.1/lib/libvarnishcompat/asprintf.c branches/1.1/lib/libvarnishcompat/daemon.c branches/1.1/lib/libvarnishcompat/setproctitle.c branches/1.1/lib/libvarnishcompat/srandomdev.c branches/1.1/lib/libvarnishcompat/strlcat.c branches/1.1/lib/libvarnishcompat/strlcpy.c branches/1.1/lib/libvarnishcompat/strndup.c branches/1.1/lib/libvarnishcompat/vasprintf.c branches/1.1/lib/libvarnishcompat/vis.c branches/1.1/lib/libvcl/Makefile.am branches/1.1/lib/libvcl/vcc_acl.c branches/1.1/lib/libvcl/vcc_action.c branches/1.1/lib/libvcl/vcc_backend.c branches/1.1/lib/libvcl/vcc_compile.c branches/1.1/lib/libvcl/vcc_fixed_token.c branches/1.1/lib/libvcl/vcc_gen_fixed_token.tcl branches/1.1/lib/libvcl/vcc_gen_obj.tcl branches/1.1/lib/libvcl/vcc_obj.c branches/1.1/lib/libvcl/vcc_parse.c branches/1.1/lib/libvcl/vcc_string.c branches/1.1/lib/libvcl/vcc_token.c branches/1.1/lib/libvcl/vcc_var.c branches/1.1/lib/libvcl/vcc_xref.c Log: Merged revisions 2323,2325-2327,2337,2358,2362-2364,2366,2374,2376-2378,2380-2382,2384-2386,2404,2426,2432-2434,2453-2456,2458-2461,2467,2495-2499,2503-2505,2522-2524,2545,2563-2565 via svnmerge from svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache ........ r2337 | phk | 2008-01-08 15:35:09 +0100 (Tue, 08 Jan 2008) | 4 lines Don't even look for senfile, it doesn't work for what we need on any of the platforms right now. ........ r2382 | des | 2008-01-23 21:23:20 +0100 (Wed, 23 Jan 2008) | 13 lines Improve readability, such as it is. Allow the user to disable specific acceptor mechanisms (e.g. do not use epoll even though it is available). Don't look for kqueue on systems where we know it doesn't work. Bail if no acceptor mechanism was found. Bail if no curses or ncurses was found. Warn the user if SO_{RCV,SND}TIMEO are non-functional. ........ r2404 | phk | 2008-01-30 11:02:19 +0100 (Wed, 30 Jan 2008) | 4 lines Make sure we get the right assert() macro. Constification. ........ r2453 | des | 2008-02-13 14:05:36 +0100 (Wed, 13 Feb 2008) | 4 lines Some source files (especially in libraries) have embedded test programs. Add a configure option and a corresponding automake conditional to enable these tests. ........ r2454 | des | 2008-02-13 14:29:40 +0100 (Wed, 13 Feb 2008) | 2 lines Rewrite str2bytes, add unit test ........ r2455 | des | 2008-02-13 14:55:39 +0100 (Wed, 13 Feb 2008) | 2 lines Use #include "config.h" instead of -include config.h ........ r2456 | des | 2008-02-13 15:58:48 +0100 (Wed, 13 Feb 2008) | 2 lines Disable tools that require curses if no curses library was found. ........ r2458 | des | 2008-02-13 18:12:59 +0100 (Wed, 13 Feb 2008) | 2 lines Enable tests + allow overrides from command line. ........ r2459 | des | 2008-02-13 18:19:52 +0100 (Wed, 13 Feb 2008) | 2 lines Never mind trying to avoid libm, we already use it anyway. ........ r2460 | des | 2008-02-13 18:25:52 +0100 (Wed, 13 Feb 2008) | 2 lines Forgot config.h here ........ r2461 | des | 2008-02-13 18:25:57 +0100 (Wed, 13 Feb 2008) | 2 lines Regenerate ........ r2467 | phk | 2008-02-15 11:01:19 +0100 (Fri, 15 Feb 2008) | 2 lines remove the undocumented and unimplemented dump.pool command ........ r2565 | des | 2008-03-08 14:47:56 +0100 (Sat, 08 Mar 2008) | 2 lines dump.pool was removed a while ago. ........ Property changes on: branches/1.1 ___________________________________________________________________ Name: svnmerge-integrated - /trunk/varnish-cache:1-1722,1727-1729,1733,1738,1743-1777,1779-1798,1800-1815,1817,1819,1823,1830-1838,1846,1853-1855,1857-1859,1862,1865-1868,1871-1880,1883-1884,1886,1888-1889,1896,1898,1902-1905,1907,1909,1912-1916,1920-1928,1935-1939,1941-1949,1955,1957-1958,1967-1968,1970-1974,1976-1977,1984,1986-1989,1991-1998,2026,2031-2033,2057,2077-2080,2086,2088,2091,2097,2106-2107,2116,2133,2154,2173,2181,2206-2207,2211-2212,2215-2245,2256-2262,2270-2271,2275,2285-2286,2288-2291,2295-2301,2304-2327,2357-2359,2361-2364,2366,2374-2381,2383-2386,2414-2415,2421-2422,2426,2432-2434,2444-2445,2447,2457,2492-2494,2500-2502,2520-2521 + /trunk/varnish-cache:1-1722,1727-1729,1733,1738,1743-1777,1779-1798,1800-1815,1817,1819,1823,1830-1838,1846,1853-1855,1857-1859,1862,1865-1868,1871-1880,1883-1884,1886,1888-1889,1896,1898,1902-1905,1907,1909,1912-1916,1920-1928,1935-1939,1941-1949,1955,1957-1958,1967-1968,1970-1974,1976-1977,1984,1986-1989,1991-1998,2026,2031-2033,2057,2077-2080,2086,2088,2091,2097,2106-2107,2116,2133,2154,2173,2181,2206-2207,2211-2212,2215-2245,2256-2262,2270-2271,2275,2285-2286,2288-2291,2295-2301,2304-2327,2337,2357-2359,2361-2364,2366,2374-2386,2404,2414-2415,2421-2422,2426,2432-2434,2444-2445,2447,2453-2461,2467,2492-2505,2520-2524,2545,2563-2565 Modified: branches/1.1/autogen.des =================================================================== --- branches/1.1/autogen.des 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/autogen.des 2008-03-08 14:12:52 UTC (rev 2568) @@ -18,6 +18,8 @@ --enable-diagnostics \ --enable-extra-developer-warnings \ --enable-stack-protector \ + --enable-tests \ --enable-werror \ --prefix=/opt/varnish \ - --mandir=/opt/varnish/man + --mandir=/opt/varnish/man \ + "$@" Modified: branches/1.1/bin/Makefile.am =================================================================== --- branches/1.1/bin/Makefile.am 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/Makefile.am 2008-03-08 14:12:52 UTC (rev 2568) @@ -1,4 +1,7 @@ # $Id$ -SUBDIRS = varnishadm varnishd varnishhist varnishlog varnishncsa \ - varnishreplay varnishstat varnishtop +SUBDIRS = varnishadm varnishd varnishlog varnishncsa varnishreplay + +if HAVE_CURSES +SUBDIRS += varnishhist varnishstat varnishtop +endif Modified: branches/1.1/bin/varnishadm/Makefile.am =================================================================== --- branches/1.1/bin/varnishadm/Makefile.am 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishadm/Makefile.am 2008-03-08 14:12:52 UTC (rev 2568) @@ -8,8 +8,6 @@ varnishadm_SOURCES = \ varnishadm.c - -varnishadm_CFLAGS = -include config.h varnishadm_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ Modified: branches/1.1/bin/varnishadm/varnishadm.c =================================================================== --- branches/1.1/bin/varnishadm/varnishadm.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishadm/varnishadm.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: branches/1.1/bin/varnishd/Makefile.am =================================================================== --- branches/1.1/bin/varnishd/Makefile.am 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/Makefile.am 2008-03-08 14:12:52 UTC (rev 2568) @@ -60,7 +60,7 @@ steps.h \ stevedore.h -varnishd_CFLAGS = -include config.h \ +varnishd_CFLAGS = \ -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' varnishd_LDFLAGS = -export-dynamic Modified: branches/1.1/bin/varnishd/cache_acceptor.c =================================================================== --- branches/1.1/bin/varnishd/cache_acceptor.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_acceptor.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -33,6 +33,8 @@ * write the session pointer to a pipe which the event engine monitors. */ +#include "config.h" + #include #include #include Modified: branches/1.1/bin/varnishd/cache_acceptor_epoll.c =================================================================== --- branches/1.1/bin/varnishd/cache_acceptor_epoll.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_acceptor_epoll.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -31,6 +31,8 @@ * write the session pointer to a pipe which the event engine monitors. */ +#include "config.h" + #if defined(HAVE_EPOLL_CTL) #include Modified: branches/1.1/bin/varnishd/cache_acceptor_kqueue.c =================================================================== --- branches/1.1/bin/varnishd/cache_acceptor_kqueue.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_acceptor_kqueue.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -33,6 +33,8 @@ * write the session pointer to a pipe which the event engine monitors. */ +#include "config.h" + #if defined(HAVE_KQUEUE) #include Modified: branches/1.1/bin/varnishd/cache_acceptor_poll.c =================================================================== --- branches/1.1/bin/varnishd/cache_acceptor_poll.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_acceptor_poll.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -33,6 +33,8 @@ * write the session pointer to a pipe which the event engine monitors. */ +#include "config.h" + #if defined(HAVE_POLL) #include Modified: branches/1.1/bin/varnishd/cache_backend.c =================================================================== --- branches/1.1/bin/varnishd/cache_backend.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_backend.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -35,19 +35,21 @@ * XXX: drops to zero we should zap them. */ -#include +#include "config.h" + +#include +#include #include -#include -#include #include #include #include #include #include -#include -#include +#include +#include + #include "heritage.h" #include "shmlog.h" #include "cache.h" Modified: branches/1.1/bin/varnishd/cache_ban.c =================================================================== --- branches/1.1/bin/varnishd/cache_ban.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_ban.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -31,6 +31,8 @@ * Ban processing */ +#include "config.h" + #include #include Modified: branches/1.1/bin/varnishd/cache_center.c =================================================================== --- branches/1.1/bin/varnishd/cache_center.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_center.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -56,6 +56,8 @@ DOT start -> recv [style=bold,color=green,weight=4] */ +#include "config.h" + #include #include #include Modified: branches/1.1/bin/varnishd/cache_cli.c =================================================================== --- branches/1.1/bin/varnishd/cache_cli.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_cli.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include @@ -72,10 +74,6 @@ { CLI_VCL_DISCARD, cli_func_config_discard }, { CLI_VCL_USE, cli_func_config_use }, - /* Undocumented */ - { "dump.pool", "dump.pool", - "\tDump the worker thread pool state\n", - 0, 0, cli_func_dump_pool }, { NULL } }; Modified: branches/1.1/bin/varnishd/cache_expire.c =================================================================== --- branches/1.1/bin/varnishd/cache_expire.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_expire.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -38,6 +38,8 @@ * XXX: are ready. */ +#include "config.h" + #include #include #include Modified: branches/1.1/bin/varnishd/cache_fetch.c =================================================================== --- branches/1.1/bin/varnishd/cache_fetch.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_fetch.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: branches/1.1/bin/varnishd/cache_hash.c =================================================================== --- branches/1.1/bin/varnishd/cache_hash.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_hash.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -52,6 +52,8 @@ * not busy only once. */ +#include "config.h" + #include #include #include Modified: branches/1.1/bin/varnishd/cache_http.c =================================================================== --- branches/1.1/bin/varnishd/cache_http.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_http.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -31,6 +31,8 @@ * HTTP request storage and manipulation */ +#include "config.h" + #include #include #include Modified: branches/1.1/bin/varnishd/cache_main.c =================================================================== --- branches/1.1/bin/varnishd/cache_main.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_main.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: branches/1.1/bin/varnishd/cache_pipe.c =================================================================== --- branches/1.1/bin/varnishd/cache_pipe.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_pipe.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -31,6 +31,8 @@ * XXX: charge bytes to srcaddr */ +#include "config.h" + #include #include #include Modified: branches/1.1/bin/varnishd/cache_pool.c =================================================================== --- branches/1.1/bin/varnishd/cache_pool.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_pool.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -31,6 +31,8 @@ * XXX: automatic thread-pool size adaptation. */ +#include "config.h" + #include #include @@ -432,14 +434,3 @@ AZ(pthread_create(&tp, NULL, wrk_reaperthread, NULL)); AZ(pthread_detach(tp)); } - -/*--------------------------------------------------------------------*/ - -void -cli_func_dump_pool(struct cli *cli, char **av, void *priv) -{ - - (void)cli; - (void)av; - (void)priv; -} Modified: branches/1.1/bin/varnishd/cache_response.c =================================================================== --- branches/1.1/bin/varnishd/cache_response.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_response.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.1/bin/varnishd/cache_session.c =================================================================== --- branches/1.1/bin/varnishd/cache_session.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_session.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -48,6 +48,8 @@ * XXX: we still have to do the source-addr lookup. */ +#include "config.h" + #include #include #include Modified: branches/1.1/bin/varnishd/cache_synthetic.c =================================================================== --- branches/1.1/bin/varnishd/cache_synthetic.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_synthetic.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -28,6 +28,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.1/bin/varnishd/cache_vary.c =================================================================== --- branches/1.1/bin/varnishd/cache_vary.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_vary.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -54,6 +54,8 @@ * '\0' */ +#include "config.h" + #include #include #include Modified: branches/1.1/bin/varnishd/cache_vcl.c =================================================================== --- branches/1.1/bin/varnishd/cache_vcl.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_vcl.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -33,6 +33,8 @@ * The interface *from* the compiled VCL code is in cache_vrt.c. */ +#include "config.h" + #include #include #include Modified: branches/1.1/bin/varnishd/cache_vrt.c =================================================================== --- branches/1.1/bin/varnishd/cache_vrt.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_vrt.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -31,6 +31,8 @@ * Runtime support for compiled VCL programs */ +#include "config.h" + #include #include Modified: branches/1.1/bin/varnishd/cache_vrt_acl.c =================================================================== --- branches/1.1/bin/varnishd/cache_vrt_acl.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_vrt_acl.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -34,6 +34,8 @@ * XXX: a refresh facility. */ +#include "config.h" + #include #include Modified: branches/1.1/bin/varnishd/cache_vrt_re.c =================================================================== --- branches/1.1/bin/varnishd/cache_vrt_re.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_vrt_re.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -31,6 +31,8 @@ * Runtime support for compiled VCL programs, regexps */ +#include "config.h" + #include #include Modified: branches/1.1/bin/varnishd/cache_ws.c =================================================================== --- branches/1.1/bin/varnishd/cache_ws.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/cache_ws.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -30,6 +30,8 @@ * */ +#include "config.h" + #include #include Modified: branches/1.1/bin/varnishd/hash_classic.c =================================================================== --- branches/1.1/bin/varnishd/hash_classic.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/hash_classic.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -31,6 +31,8 @@ * A classic bucketed hash */ +#include "config.h" + #include #include #include Modified: branches/1.1/bin/varnishd/hash_simple_list.c =================================================================== --- branches/1.1/bin/varnishd/hash_simple_list.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/hash_simple_list.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -31,6 +31,8 @@ * This is the reference hash(/lookup) implementation */ +#include "config.h" + #include #include Modified: branches/1.1/bin/varnishd/mgt_child.c =================================================================== --- branches/1.1/bin/varnishd/mgt_child.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/mgt_child.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -31,6 +31,8 @@ * The mechanics of handling the child process */ +#include "config.h" + #include #include #include Modified: branches/1.1/bin/varnishd/mgt_cli.c =================================================================== --- branches/1.1/bin/varnishd/mgt_cli.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/mgt_cli.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -31,6 +31,8 @@ * The management process' CLI handling */ +#include "config.h" + #include #include Modified: branches/1.1/bin/varnishd/mgt_event.c =================================================================== --- branches/1.1/bin/varnishd/mgt_event.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/mgt_event.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: branches/1.1/bin/varnishd/mgt_param.c =================================================================== --- branches/1.1/bin/varnishd/mgt_param.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/mgt_param.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.1/bin/varnishd/mgt_vcc.c =================================================================== --- branches/1.1/bin/varnishd/mgt_vcc.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/mgt_vcc.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -31,6 +31,8 @@ * VCL compiler stuff */ +#include "config.h" + #include #include Modified: branches/1.1/bin/varnishd/rfc2616.c =================================================================== --- branches/1.1/bin/varnishd/rfc2616.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/rfc2616.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.1/bin/varnishd/shmlog.c =================================================================== --- branches/1.1/bin/varnishd/shmlog.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/shmlog.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: branches/1.1/bin/varnishd/stevedore.c =================================================================== --- branches/1.1/bin/varnishd/stevedore.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/stevedore.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -28,6 +28,8 @@ * $Id$ */ +#include "config.h" + #include "cache.h" struct storage * Modified: branches/1.1/bin/varnishd/storage_file.c =================================================================== --- branches/1.1/bin/varnishd/storage_file.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/storage_file.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -31,6 +31,8 @@ * Storage method based on mmap'ed file */ +#include "config.h" + #include #include #include Modified: branches/1.1/bin/varnishd/storage_malloc.c =================================================================== --- branches/1.1/bin/varnishd/storage_malloc.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/storage_malloc.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -31,6 +31,8 @@ * Storage method based on malloc(3) */ +#include "config.h" + #include #include Modified: branches/1.1/bin/varnishd/tcp.c =================================================================== --- branches/1.1/bin/varnishd/tcp.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/tcp.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.1/bin/varnishd/varnishd.1 =================================================================== --- branches/1.1/bin/varnishd/varnishd.1 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/varnishd.1 2008-03-08 14:12:52 UTC (rev 2568) @@ -28,7 +28,7 @@ .\" .\" $Id$ .\" -.Dd July 5, 2007 +.Dd March 8, 2008 .Dt VARNISHD 1 .Os .Sh NAME @@ -287,7 +287,6 @@ address and port. The following commands are available: .Bl -tag -width 4n -.It Cm dump.pool .It Cm help Display a list of available commands. .It Cm param.set Ar param Ar value Modified: branches/1.1/bin/varnishd/varnishd.c =================================================================== --- branches/1.1/bin/varnishd/varnishd.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishd/varnishd.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -31,6 +31,8 @@ * The management process and CLI handling */ +#include "config.h" + #include #include Modified: branches/1.1/bin/varnishhist/Makefile.am =================================================================== --- branches/1.1/bin/varnishhist/Makefile.am 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishhist/Makefile.am 2008-03-08 14:12:52 UTC (rev 2568) @@ -8,8 +8,6 @@ varnishhist_SOURCES = varnishhist.c -varnishhist_CFLAGS = -include config.h - varnishhist_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ Modified: branches/1.1/bin/varnishhist/varnishhist.c =================================================================== --- branches/1.1/bin/varnishhist/varnishhist.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishhist/varnishhist.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -32,6 +32,8 @@ * Log tailer for Varnish */ +#include "config.h" + #include #include #include Modified: branches/1.1/bin/varnishlog/Makefile.am =================================================================== --- branches/1.1/bin/varnishlog/Makefile.am 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishlog/Makefile.am 2008-03-08 14:12:52 UTC (rev 2568) @@ -8,8 +8,6 @@ varnishlog_SOURCES = varnishlog.c -varnishlog_CFLAGS = -include config.h - varnishlog_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ Modified: branches/1.1/bin/varnishlog/varnishlog.c =================================================================== --- branches/1.1/bin/varnishlog/varnishlog.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishlog/varnishlog.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -31,6 +31,8 @@ * Log tailer for Varnish */ +#include "config.h" + #include #include #include Modified: branches/1.1/bin/varnishncsa/Makefile.am =================================================================== --- branches/1.1/bin/varnishncsa/Makefile.am 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishncsa/Makefile.am 2008-03-08 14:12:52 UTC (rev 2568) @@ -8,8 +8,6 @@ varnishncsa_SOURCES = varnishncsa.c -varnishncsa_CFLAGS = -include config.h - varnishncsa_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ Modified: branches/1.1/bin/varnishncsa/varnishncsa.c =================================================================== --- branches/1.1/bin/varnishncsa/varnishncsa.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishncsa/varnishncsa.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -59,6 +59,8 @@ * - Maybe rotate/compress log */ +#include "config.h" + #include #include #include Modified: branches/1.1/bin/varnishreplay/Makefile.am =================================================================== --- branches/1.1/bin/varnishreplay/Makefile.am 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishreplay/Makefile.am 2008-03-08 14:12:52 UTC (rev 2568) @@ -8,8 +8,6 @@ varnishreplay_SOURCES = \ varnishreplay.c - -varnishreplay_CFLAGS = -include config.h varnishreplay_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ Modified: branches/1.1/bin/varnishreplay/varnishreplay.c =================================================================== --- branches/1.1/bin/varnishreplay/varnishreplay.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishreplay/varnishreplay.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -28,6 +28,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: branches/1.1/bin/varnishstat/Makefile.am =================================================================== --- branches/1.1/bin/varnishstat/Makefile.am 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishstat/Makefile.am 2008-03-08 14:12:52 UTC (rev 2568) @@ -8,8 +8,6 @@ varnishstat_SOURCES = varnishstat.c -varnishstat_CFLAGS = -include config.h - varnishstat_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ Modified: branches/1.1/bin/varnishstat/varnishstat.c =================================================================== --- branches/1.1/bin/varnishstat/varnishstat.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishstat/varnishstat.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -32,6 +32,8 @@ * Log tailer for Varnish */ +#include "config.h" + #include #include Modified: branches/1.1/bin/varnishtop/Makefile.am =================================================================== --- branches/1.1/bin/varnishtop/Makefile.am 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishtop/Makefile.am 2008-03-08 14:12:52 UTC (rev 2568) @@ -8,8 +8,6 @@ varnishtop_SOURCES = varnishtop.c -varnishtop_CFLAGS = -include config.h - varnishtop_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ Modified: branches/1.1/bin/varnishtop/varnishtop.c =================================================================== --- branches/1.1/bin/varnishtop/varnishtop.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/bin/varnishtop/varnishtop.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -32,6 +32,8 @@ * Log tailer for Varnish */ +#include "config.h" + #include #include #include Modified: branches/1.1/configure.ac =================================================================== --- branches/1.1/configure.ac 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/configure.ac 2008-03-08 14:12:52 UTC (rev 2568) @@ -38,10 +38,15 @@ save_LIBS="${LIBS}" LIBS="" -AC_SEARCH_LIBS(initscr, [curses ncurses]) +AC_SEARCH_LIBS(initscr, [curses ncurses], + [have_curses=yes], [have_curses=no]) CURSES_LIBS="${LIBS}" LIBS="${save_LIBS}" AC_SUBST(CURSES_LIBS) +if test "$have_curses" = no; then + AC_MSG_WARN([curses not found; some tools will not be built]) +fi +AM_CONDITIONAL([HAVE_CURSES], [test x$have_curses = xyes]) save_LIBS="${LIBS}" LIBS="" @@ -93,15 +98,18 @@ AC_CHECK_FUNCS([socket]) AC_CHECK_FUNCS([strptime]) -# This one is tricky, there are multiple versions -case $host in -*-*-freebsd*|*-*-linux*) - AC_CHECK_FUNCS([sendfile]) - ;; -*) - AC_MSG_WARN([won't look for sendfile() on $host]) - ;; -esac +# Don't look for sendfile at all, none of them work +# anyway. (don't tell when done with passed mem-range) +# +## This one is tricky, there are multiple versions +#case $host in +#*-*-freebsd*|*-*-linux*) +# AC_CHECK_FUNCS([sendfile]) +# ;; +#*) +# AC_MSG_WARN([won't look for sendfile() on $host]) +# ;; +#esac # These functions are provided by libcompat on platforms where they # are not available @@ -118,12 +126,71 @@ AC_CHECK_FUNCS([clock_gettime]) LIBS="${save_LIBS}" -# Check which mechanism to use for the acceptor -AC_CHECK_FUNCS([kqueue]) -AC_CHECK_FUNCS([epoll_ctl]) -AC_CHECK_FUNCS([poll]) +# Check which mechanism to use for the acceptor. We look for kqueue +# only on platforms on which we know that it works, because there are +# platforms where a simple AC_CHECK_FUNCS([kqueue]) would succeed but +# the build would fail. We also allow the user to disable mechanisms +# he doesn't want to use. -# Solaris defines SO_{RCV,SND}TIMEO, but does not implement them +# --enable-kqueue +AC_ARG_ENABLE(kqueue, + AS_HELP_STRING([--enable-kqueue], + [use kqueue if available (default is YES)]), + , + [enable_kqueue=yes]) + +if test "$enable_kqueue" = yes; then + case $host in + *-*-freebsd*) + AC_CHECK_FUNCS([kqueue]) + ;; + *-*-bsd*) + # No other BSD has a sufficiently recent implementation + AC_MSG_WARN([won't look for kqueue() on $host]) + ac_cv_func_kqueue=no + ;; + esac +else + ac_cv_func_kqueue=no +fi + +# --enable-epoll +AC_ARG_ENABLE(epoll, + AS_HELP_STRING([--enable-epoll], + [use epoll if available (default is YES)]), + , + [enable_epoll=yes]) + +if test "$enable_epoll" = yes; then + AC_CHECK_FUNCS([epoll_ctl]) +else + ac_cv_func_epoll_ctl=no +fi + +# --enable-poll +AC_ARG_ENABLE(poll, + AS_HELP_STRING([--enable-poll], + [use poll if available (default is YES)]), + , + [enable_poll=yes]) + +if test "$enable_poll" = yes; then + AC_CHECK_FUNCS([poll]) +else + ac_cv_func_poll=no +fi + +if test "$ac_cv_func_kqueue" != yes && + test "$ac_cv_func_epoll_ctl" != yes && + test "$ac_cv_func_poll" != yes; then + AC_MSG_ERROR([no usable acceptor mechanism]) +fi + +# Solaris defines SO_{RCV,SND}TIMEO, but does not implement them. +# Varnish will build and run without these, but connections will not +# time out, which may leave Varnish vulnerable to denail-of-service +# attacks which would not be possible on other platforms. + AC_CACHE_CHECK([whether SO_RCVTIMEO works], [ac_cv_so_rcvtimeo_works], [AC_RUN_IFELSE( @@ -162,6 +229,11 @@ AC_DEFINE([SO_SNDTIMEO_WORKS], [1], [Define if SO_SNDTIMEO works]) fi +if test "$ac_cv_so_rcvtimeo_works" = no || + test "$ac_cv_so_sndtimeo_works" = no; then + AC_MSG_WARN([connection timeouts will not work]) +fi + # Run-time directory VARNISH_STATE_DIR='${localstatedir}/varnish' AC_SUBST(VARNISH_STATE_DIR) @@ -175,21 +247,37 @@ # Additional flags for GCC 4 EXTRA_DEVELOPER_CFLAGS="-Wextra -Wno-missing-field-initializers -Wno-sign-compare" +# --enable-developer-warnings AC_ARG_ENABLE(developer-warnings, AS_HELP_STRING([--enable-developer-warnings],[enable strict warnings (default is NO)]), CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}") + +# --enable-debugging-symbols AC_ARG_ENABLE(debugging-symbols, AS_HELP_STRING([--enable-debugging-symbols],[enable debugging symbols (default is NO)]), CFLAGS="${CFLAGS} -O0 -g -fno-inline") + +# --enable-diagnostics AC_ARG_ENABLE(diagnostics, AS_HELP_STRING([--enable-diagnostics],[enable run-time diagnostics (default is NO)]), CFLAGS="${CFLAGS} -DDIAGNOSTICS") + +# --enable-extra-developer-warnings AC_ARG_ENABLE(extra-developer-warnings, AS_HELP_STRING([--enable-extra-developer-warnings],[enable even stricter warnings (default is NO)]), CFLAGS="${CFLAGS} ${EXTRA_DEVELOPER_CFLAGS}") + +# --enable-stack-protector AC_ARG_ENABLE(stack-protector, AS_HELP_STRING([--enable-stack-protector],[enable stack protector (default is NO)]), CFLAGS="${CFLAGS} -fstack-protector-all") + +# --enable-tests +AC_ARG_ENABLE(tests, + AS_HELP_STRING([--enable-tests],[build test programs (default is NO)])) +AM_CONDITIONAL([ENABLE_TESTS], [test x$enable_tests = xyes]) + +# --enable-werror AC_ARG_ENABLE(werror, AS_HELP_STRING([--enable-werror],[use -Werror (default is NO)]), CFLAGS="${CFLAGS} -Werror") Modified: branches/1.1/include/binary_heap.h =================================================================== --- branches/1.1/include/binary_heap.h 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/include/binary_heap.h 2008-03-08 14:12:52 UTC (rev 2568) @@ -69,7 +69,7 @@ * The root item has 'idx' zero */ -void *binheap_root(struct binheap *); +void *binheap_root(const struct binheap *); /* * Return the root item */ Modified: branches/1.1/lib/libvarnish/Makefile.am =================================================================== --- branches/1.1/lib/libvarnish/Makefile.am 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnish/Makefile.am 2008-03-08 14:12:52 UTC (rev 2568) @@ -18,6 +18,4 @@ vsb.c \ vss.c -libvarnish_la_CFLAGS = -include config.h - -libvarnish_la_LIBADD = ${RT_LIBS} +libvarnish_la_LIBADD = ${RT_LIBS} ${NET_LIBS} ${LIBM} Modified: branches/1.1/lib/libvarnish/argv.c =================================================================== --- branches/1.1/lib/libvarnish/argv.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnish/argv.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -38,6 +38,8 @@ * */ +#include "config.h" + #include #include #include Modified: branches/1.1/lib/libvarnish/assert.c =================================================================== --- branches/1.1/lib/libvarnish/assert.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnish/assert.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: branches/1.1/lib/libvarnish/binary_heap.c =================================================================== --- branches/1.1/lib/libvarnish/binary_heap.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnish/binary_heap.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -36,11 +36,13 @@ * XXX: the array is not scaled back when items are deleted. */ -#include +#include "config.h" + #include #include #include "binary_heap.h" +#include "libvarnish.h" /* Private definitions -----------------------------------------------*/ @@ -66,7 +68,7 @@ /* Implementation ----------------------------------------------------*/ static void -binheap_update(struct binheap *bh, unsigned u) +binheap_update(const struct binheap *bh, unsigned u) { assert(bh->magic == BINHEAP_MAGIC); assert(u < bh->next); @@ -97,7 +99,7 @@ } static void -binhead_swap(struct binheap *bh, unsigned u, unsigned v) +binhead_swap(const struct binheap *bh, unsigned u, unsigned v) { void *p; @@ -112,7 +114,7 @@ } static unsigned -binheap_trickleup(struct binheap *bh, unsigned u) +binheap_trickleup(const struct binheap *bh, unsigned u) { unsigned v; @@ -129,7 +131,7 @@ } static void -binheap_trickledown(struct binheap *bh, unsigned u) +binheap_trickledown(const struct binheap *bh, unsigned u) { unsigned v1, v2; @@ -182,11 +184,11 @@ u = bh->next++; bh->array[u] = p; binheap_update(bh, u); - binheap_trickleup(bh, u); + (void)binheap_trickleup(bh, u); } void * -binheap_root(struct binheap *bh) +binheap_root(const struct binheap *bh) { assert(bh != NULL); Modified: branches/1.1/lib/libvarnish/cli.c =================================================================== --- branches/1.1/lib/libvarnish/cli.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnish/cli.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -31,6 +31,8 @@ * Stuff for handling the CLI protocol */ +#include "config.h" + #include #include #include Modified: branches/1.1/lib/libvarnish/cli_common.c =================================================================== --- branches/1.1/lib/libvarnish/cli_common.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnish/cli_common.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.1/lib/libvarnish/crc32.c =================================================================== --- branches/1.1/lib/libvarnish/crc32.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnish/crc32.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -31,6 +31,8 @@ * This CRC32 implementation is in the public domain. */ +#include "config.h" + #include "libvarnish.h" /*--------------------------------------------------------------------*/ Modified: branches/1.1/lib/libvarnish/flopen.c =================================================================== --- branches/1.1/lib/libvarnish/flopen.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnish/flopen.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $FreeBSD: src/lib/libutil/flopen.c,v 1.7 2007/05/23 12:09:33 des Exp $ */ +#include "config.h" + #include #include Modified: branches/1.1/lib/libvarnish/time.c =================================================================== --- branches/1.1/lib/libvarnish/time.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnish/time.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -46,6 +46,8 @@ * */ +#include "config.h" + #include #include Modified: branches/1.1/lib/libvarnish/version.c =================================================================== --- branches/1.1/lib/libvarnish/version.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnish/version.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -31,6 +31,8 @@ * Display a standardized version message. */ +#include "config.h" + #include #include "libvarnish.h" Modified: branches/1.1/lib/libvarnish/vpf.c =================================================================== --- branches/1.1/lib/libvarnish/vpf.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnish/vpf.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -28,6 +28,8 @@ * $FreeBSD: src/lib/libutil/pidfile.c,v 1.5 2007/05/11 11:10:05 des Exp $ */ +#include "config.h" + #include #include #include Modified: branches/1.1/lib/libvarnish/vsb.c =================================================================== --- branches/1.1/lib/libvarnish/vsb.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnish/vsb.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $FreeBSD: src/sys/kern/subr_sbuf.c,v 1.30 2005/12/23 11:49:53 phk Exp $ */ +#include "config.h" + #include #include #include Modified: branches/1.1/lib/libvarnish/vss.c =================================================================== --- branches/1.1/lib/libvarnish/vss.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnish/vss.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -30,6 +30,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.1/lib/libvarnishapi/Makefile.am =================================================================== --- branches/1.1/lib/libvarnishapi/Makefile.am 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnishapi/Makefile.am 2008-03-08 14:12:52 UTC (rev 2568) @@ -9,5 +9,5 @@ instance.c \ shmlog.c -libvarnishapi_la_CFLAGS = -include config.h \ +libvarnishapi_la_CFLAGS = \ -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' Modified: branches/1.1/lib/libvarnishapi/base64.c =================================================================== --- branches/1.1/lib/libvarnishapi/base64.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnishapi/base64.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -6,6 +6,8 @@ * $Id$ */ +#include "config.h" + #include #include #include "varnishapi.h" Modified: branches/1.1/lib/libvarnishapi/instance.c =================================================================== --- branches/1.1/lib/libvarnishapi/instance.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnishapi/instance.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -28,6 +28,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: branches/1.1/lib/libvarnishapi/shmlog.c =================================================================== --- branches/1.1/lib/libvarnishapi/shmlog.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnishapi/shmlog.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,9 @@ * $Id$ */ +#include "config.h" + +#include #include #include Modified: branches/1.1/lib/libvarnishcompat/Makefile.am =================================================================== --- branches/1.1/lib/libvarnishcompat/Makefile.am 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnishcompat/Makefile.am 2008-03-08 14:12:52 UTC (rev 2568) @@ -14,5 +14,3 @@ strlcpy.c \ strndup.c \ vis.c - -libvarnishcompat_la_CFLAGS = -include config.h Modified: branches/1.1/lib/libvarnishcompat/asprintf.c =================================================================== --- branches/1.1/lib/libvarnishcompat/asprintf.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnishcompat/asprintf.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -30,6 +30,8 @@ * */ +#include "config.h" + #ifndef HAVE_ASPRINTF #include Modified: branches/1.1/lib/libvarnishcompat/daemon.c =================================================================== --- branches/1.1/lib/libvarnishcompat/daemon.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnishcompat/daemon.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -31,6 +31,8 @@ * $FreeBSD: src/lib/libc/gen/daemon.c,v 1.8 2007/01/09 00:27:53 imp Exp $ */ +#include "config.h" + #ifndef HAVE_DAEMON #include Modified: branches/1.1/lib/libvarnishcompat/setproctitle.c =================================================================== --- branches/1.1/lib/libvarnishcompat/setproctitle.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnishcompat/setproctitle.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #ifndef HAVE_SETPROCTITLE #include Modified: branches/1.1/lib/libvarnishcompat/srandomdev.c =================================================================== --- branches/1.1/lib/libvarnishcompat/srandomdev.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnishcompat/srandomdev.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #ifndef HAVE_SRANDOMDEV #include Modified: branches/1.1/lib/libvarnishcompat/strlcat.c =================================================================== --- branches/1.1/lib/libvarnishcompat/strlcat.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnishcompat/strlcat.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -17,6 +17,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" + #ifndef HAVE_STRLCAT #include Modified: branches/1.1/lib/libvarnishcompat/strlcpy.c =================================================================== --- branches/1.1/lib/libvarnishcompat/strlcpy.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnishcompat/strlcpy.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -17,6 +17,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" + #ifndef HAVE_STRLCPY #include Modified: branches/1.1/lib/libvarnishcompat/strndup.c =================================================================== --- branches/1.1/lib/libvarnishcompat/strndup.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnishcompat/strndup.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -30,6 +30,8 @@ * */ +#include "config.h" + #ifndef HAVE_STRNDUP #include Modified: branches/1.1/lib/libvarnishcompat/vasprintf.c =================================================================== --- branches/1.1/lib/libvarnishcompat/vasprintf.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnishcompat/vasprintf.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -30,6 +30,8 @@ * */ +#include "config.h" + #ifndef HAVE_VASPRINTF #include Modified: branches/1.1/lib/libvarnishcompat/vis.c =================================================================== --- branches/1.1/lib/libvarnishcompat/vis.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvarnishcompat/vis.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -31,6 +31,8 @@ * $Id$ */ +#include "config.h" + #if !defined(HAVE_VIS) || !defined(HAVE_STRVIS) || !defined(HAVE_STRVISX) #include Modified: branches/1.1/lib/libvcl/Makefile.am =================================================================== --- branches/1.1/lib/libvcl/Makefile.am 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvcl/Makefile.am 2008-03-08 14:12:52 UTC (rev 2568) @@ -20,5 +20,3 @@ vcc_token.c \ vcc_var.c \ vcc_xref.c - -libvcl_la_CFLAGS = -include config.h Modified: branches/1.1/lib/libvcl/vcc_acl.c =================================================================== --- branches/1.1/lib/libvcl/vcc_acl.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvcl/vcc_acl.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.1/lib/libvcl/vcc_action.c =================================================================== --- branches/1.1/lib/libvcl/vcc_action.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvcl/vcc_action.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include "vsb.h" Modified: branches/1.1/lib/libvcl/vcc_backend.c =================================================================== --- branches/1.1/lib/libvcl/vcc_backend.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvcl/vcc_backend.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.1/lib/libvcl/vcc_compile.c =================================================================== --- branches/1.1/lib/libvcl/vcc_compile.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvcl/vcc_compile.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -60,6 +60,10 @@ * and all the rest... */ +#include "config.h" + +#include + #include #include #include @@ -69,8 +73,6 @@ #include #include -#include - #include "vsb.h" #include "vqueue.h" Modified: branches/1.1/lib/libvcl/vcc_fixed_token.c =================================================================== --- branches/1.1/lib/libvcl/vcc_fixed_token.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvcl/vcc_fixed_token.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -6,6 +6,7 @@ * Edit vcc_gen_fixed_token.tcl instead */ +#include "config.h" #include #include #include "vcc_priv.h" Modified: branches/1.1/lib/libvcl/vcc_gen_fixed_token.tcl =================================================================== --- branches/1.1/lib/libvcl/vcc_gen_fixed_token.tcl 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvcl/vcc_gen_fixed_token.tcl 2008-03-08 14:12:52 UTC (rev 2568) @@ -215,6 +215,7 @@ set foh [open "vcc_token_defs.h" w] warns $foh +puts $fo "#include \"config.h\"" puts $fo "#include " puts $fo "#include " puts $fo "#include \"vcc_priv.h\"" Modified: branches/1.1/lib/libvcl/vcc_gen_obj.tcl =================================================================== --- branches/1.1/lib/libvcl/vcc_gen_obj.tcl 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvcl/vcc_gen_obj.tcl 2008-03-08 14:12:52 UTC (rev 2568) @@ -253,6 +253,7 @@ puts $fo "\t{ NULL }" } +puts $fo "#include \"config.h\"" puts $fo "#include " puts $fo "#include \"vcc_compile.h\"" puts $fo "" Modified: branches/1.1/lib/libvcl/vcc_obj.c =================================================================== --- branches/1.1/lib/libvcl/vcc_obj.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvcl/vcc_obj.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -6,6 +6,7 @@ * Edit vcc_gen_obj.tcl instead */ +#include "config.h" #include #include "vcc_compile.h" Modified: branches/1.1/lib/libvcl/vcc_parse.c =================================================================== --- branches/1.1/lib/libvcl/vcc_parse.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvcl/vcc_parse.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.1/lib/libvcl/vcc_string.c =================================================================== --- branches/1.1/lib/libvcl/vcc_string.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvcl/vcc_string.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.1/lib/libvcl/vcc_token.c =================================================================== --- branches/1.1/lib/libvcl/vcc_token.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvcl/vcc_token.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: branches/1.1/lib/libvcl/vcc_var.c =================================================================== --- branches/1.1/lib/libvcl/vcc_var.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvcl/vcc_var.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: branches/1.1/lib/libvcl/vcc_xref.c =================================================================== --- branches/1.1/lib/libvcl/vcc_xref.c 2008-03-08 14:01:28 UTC (rev 2567) +++ branches/1.1/lib/libvcl/vcc_xref.c 2008-03-08 14:12:52 UTC (rev 2568) @@ -39,6 +39,8 @@ * they are called. */ +#include "config.h" + #include #include "vsb.h" From des at projects.linpro.no Sat Mar 8 15:42:23 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sat, 8 Mar 2008 16:42:23 +0100 (CET) Subject: r2569 - trunk/varnish-cache/bin/varnishlog Message-ID: <20080308154223.7E5961EC433@projects.linpro.no> Author: des Date: 2008-03-08 16:42:23 +0100 (Sat, 08 Mar 2008) New Revision: 2569 Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c Log: If it looks like a new request starts before a previous request on the same fd has finished, flush the previous request with an additional line to note that the request was interrupted. This is usually a symptom of the child dying midway through the first request. Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2008-03-08 14:12:52 UTC (rev 2568) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2008-03-08 15:42:23 UTC (rev 2569) @@ -82,6 +82,7 @@ static struct vsb *ob[65536]; static unsigned char flg[65536]; +static enum shmlogtag last[65536]; #define F_INVCL (1 << 0) #define F_MATCH (1 << 1) @@ -89,6 +90,18 @@ static regex_t match_re; static void +h_order_finish(int fd) +{ + + vsb_finish(ob[fd]); + if (vsb_len(ob[fd]) > 1 && + (match_tag == -1 || flg[fd] & F_MATCH)) + printf("%s\n", vsb_data(ob[fd])); + flg[fd] &= ~F_MATCH; + vsb_clear(ob[fd]); +} + +static void clean_order(void) { unsigned u; @@ -108,9 +121,13 @@ static int h_order(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr) { + char type; (void)priv; + type = (spec & VSL_S_CLIENT) ? 'c' : + (spec & VSL_S_BACKEND) ? 'b' : '-'; + if (!(spec & (VSL_S_CLIENT|VSL_S_BACKEND))) { if (!b_flag && !c_flag) VSL_H_Print(stdout, tag, fd, len, spec, ptr); @@ -123,6 +140,27 @@ if (tag == match_tag && !regexec(&match_re, ptr, 0, NULL, 0)) flg[fd] |= F_MATCH; + + if ((tag == SLT_BackendOpen || tag == SLT_SessionOpen || + (tag == SLT_ReqStart && + last[fd] != SLT_SessionOpen && + last[fd] != SLT_VCL_acl) || + (tag == SLT_BackendXID && + last[fd] != SLT_BackendOpen)) && + vsb_len(ob[fd]) != 0) { + /* + * This is the start of a new request, yet we haven't seen + * the end of the previous one. Spit it out anyway before + * starting on the new one. + */ + if (last[fd] != SLT_SessionClose) + vsb_printf(ob[fd], "%5d %-12s %c %s\n", + fd, "Interrupted", type, VSL_tags[tag]); + h_order_finish(fd); + } + + last[fd] = tag; + switch (tag) { case SLT_VCL_call: if (flg[fd] & F_INVCL) @@ -130,10 +168,7 @@ else flg[fd] |= F_INVCL; vsb_printf(ob[fd], "%5d %-12s %c %.*s", - fd, VSL_tags[tag], - ((spec & VSL_S_CLIENT) ? 'c' : \ - (spec & VSL_S_BACKEND) ? 'b' : '-'), - len, ptr); + fd, VSL_tags[tag], type, len, ptr); return (0); case SLT_VCL_trace: case SLT_VCL_return: @@ -151,20 +186,13 @@ flg[fd] &= ~F_INVCL; } vsb_printf(ob[fd], "%5d %-12s %c %.*s\n", - fd, VSL_tags[tag], - ((spec & VSL_S_CLIENT) ? 'c' : (spec & VSL_S_BACKEND) ? 'b' : '-'), - len, ptr); + fd, VSL_tags[tag], type, len, ptr); switch (tag) { case SLT_ReqEnd: case SLT_BackendClose: case SLT_BackendReuse: case SLT_StatSess: - vsb_finish(ob[fd]); - if (vsb_len(ob[fd]) > 1 && - (match_tag == -1 || flg[fd] & F_MATCH)) - printf("%s\n", vsb_data(ob[fd])); - flg[fd] &= ~F_MATCH; - vsb_clear(ob[fd]); + h_order_finish(fd); break; default: break; From des at projects.linpro.no Sat Mar 8 15:43:00 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sat, 8 Mar 2008 16:43:00 +0100 (CET) Subject: r2570 - in branches/1.2: . bin/varnishlog Message-ID: <20080308154300.862571EC514@projects.linpro.no> Author: des Date: 2008-03-08 16:43:00 +0100 (Sat, 08 Mar 2008) New Revision: 2570 Modified: branches/1.2/ branches/1.2/bin/varnishlog/varnishlog.c Log: Merged revisions 2569 via svnmerge from svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache ........ r2569 | des | 2008-03-08 16:42:23 +0100 (Sat, 08 Mar 2008) | 7 lines If it looks like a new request starts before a previous request on the same fd has finished, flush the previous request with an additional line to note that the request was interrupted. This is usually a symptom of the child dying midway through the first request. ........ Property changes on: branches/1.2 ___________________________________________________________________ Name: svnmerge-integrated - /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317,2319,2321-2327,2337,2358,2362-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2522-2524,2545,2563-2565 + /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317,2319,2321-2327,2337,2358,2362-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2522-2524,2545,2563-2565,2569 Modified: branches/1.2/bin/varnishlog/varnishlog.c =================================================================== --- branches/1.2/bin/varnishlog/varnishlog.c 2008-03-08 15:42:23 UTC (rev 2569) +++ branches/1.2/bin/varnishlog/varnishlog.c 2008-03-08 15:43:00 UTC (rev 2570) @@ -82,6 +82,7 @@ static struct vsb *ob[65536]; static unsigned char flg[65536]; +static enum shmlogtag last[65536]; #define F_INVCL (1 << 0) #define F_MATCH (1 << 1) @@ -89,6 +90,18 @@ static regex_t match_re; static void +h_order_finish(int fd) +{ + + vsb_finish(ob[fd]); + if (vsb_len(ob[fd]) > 1 && + (match_tag == -1 || flg[fd] & F_MATCH)) + printf("%s\n", vsb_data(ob[fd])); + flg[fd] &= ~F_MATCH; + vsb_clear(ob[fd]); +} + +static void clean_order(void) { unsigned u; @@ -108,9 +121,13 @@ static int h_order(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr) { + char type; (void)priv; + type = (spec & VSL_S_CLIENT) ? 'c' : + (spec & VSL_S_BACKEND) ? 'b' : '-'; + if (!(spec & (VSL_S_CLIENT|VSL_S_BACKEND))) { if (!b_flag && !c_flag) VSL_H_Print(stdout, tag, fd, len, spec, ptr); @@ -123,6 +140,27 @@ if (tag == match_tag && !regexec(&match_re, ptr, 0, NULL, 0)) flg[fd] |= F_MATCH; + + if ((tag == SLT_BackendOpen || tag == SLT_SessionOpen || + (tag == SLT_ReqStart && + last[fd] != SLT_SessionOpen && + last[fd] != SLT_VCL_acl) || + (tag == SLT_BackendXID && + last[fd] != SLT_BackendOpen)) && + vsb_len(ob[fd]) != 0) { + /* + * This is the start of a new request, yet we haven't seen + * the end of the previous one. Spit it out anyway before + * starting on the new one. + */ + if (last[fd] != SLT_SessionClose) + vsb_printf(ob[fd], "%5d %-12s %c %s\n", + fd, "Interrupted", type, VSL_tags[tag]); + h_order_finish(fd); + } + + last[fd] = tag; + switch (tag) { case SLT_VCL_call: if (flg[fd] & F_INVCL) @@ -130,10 +168,7 @@ else flg[fd] |= F_INVCL; vsb_printf(ob[fd], "%5d %-12s %c %.*s", - fd, VSL_tags[tag], - ((spec & VSL_S_CLIENT) ? 'c' : \ - (spec & VSL_S_BACKEND) ? 'b' : '-'), - len, ptr); + fd, VSL_tags[tag], type, len, ptr); return (0); case SLT_VCL_trace: case SLT_VCL_return: @@ -151,20 +186,13 @@ flg[fd] &= ~F_INVCL; } vsb_printf(ob[fd], "%5d %-12s %c %.*s\n", - fd, VSL_tags[tag], - ((spec & VSL_S_CLIENT) ? 'c' : (spec & VSL_S_BACKEND) ? 'b' : '-'), - len, ptr); + fd, VSL_tags[tag], type, len, ptr); switch (tag) { case SLT_ReqEnd: case SLT_BackendClose: case SLT_BackendReuse: case SLT_StatSess: - vsb_finish(ob[fd]); - if (vsb_len(ob[fd]) > 1 && - (match_tag == -1 || flg[fd] & F_MATCH)) - printf("%s\n", vsb_data(ob[fd])); - flg[fd] &= ~F_MATCH; - vsb_clear(ob[fd]); + h_order_finish(fd); break; default: break; From des at projects.linpro.no Sat Mar 8 15:43:28 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sat, 8 Mar 2008 16:43:28 +0100 (CET) Subject: r2571 - in branches/1.1: . bin/varnishlog Message-ID: <20080308154328.B55291EC433@projects.linpro.no> Author: des Date: 2008-03-08 16:43:28 +0100 (Sat, 08 Mar 2008) New Revision: 2571 Modified: branches/1.1/ branches/1.1/bin/varnishlog/varnishlog.c Log: Merged revisions 2569 via svnmerge from svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache ........ r2569 | des | 2008-03-08 16:42:23 +0100 (Sat, 08 Mar 2008) | 7 lines If it looks like a new request starts before a previous request on the same fd has finished, flush the previous request with an additional line to note that the request was interrupted. This is usually a symptom of the child dying midway through the first request. ........ Property changes on: branches/1.1 ___________________________________________________________________ Name: svnmerge-integrated - /trunk/varnish-cache:1-1722,1727-1729,1733,1738,1743-1777,1779-1798,1800-1815,1817,1819,1823,1830-1838,1846,1853-1855,1857-1859,1862,1865-1868,1871-1880,1883-1884,1886,1888-1889,1896,1898,1902-1905,1907,1909,1912-1916,1920-1928,1935-1939,1941-1949,1955,1957-1958,1967-1968,1970-1974,1976-1977,1984,1986-1989,1991-1998,2026,2031-2033,2057,2077-2080,2086,2088,2091,2097,2106-2107,2116,2133,2154,2173,2181,2206-2207,2211-2212,2215-2245,2256-2262,2270-2271,2275,2285-2286,2288-2291,2295-2301,2304-2327,2337,2357-2359,2361-2364,2366,2374-2386,2404,2414-2415,2421-2422,2426,2432-2434,2444-2445,2447,2453-2461,2467,2492-2505,2520-2524,2545,2563-2565 + /trunk/varnish-cache:1-1722,1727-1729,1733,1738,1743-1777,1779-1798,1800-1815,1817,1819,1823,1830-1838,1846,1853-1855,1857-1859,1862,1865-1868,1871-1880,1883-1884,1886,1888-1889,1896,1898,1902-1905,1907,1909,1912-1916,1920-1928,1935-1939,1941-1949,1955,1957-1958,1967-1968,1970-1974,1976-1977,1984,1986-1989,1991-1998,2026,2031-2033,2057,2077-2080,2086,2088,2091,2097,2106-2107,2116,2133,2154,2173,2181,2206-2207,2211-2212,2215-2245,2256-2262,2270-2271,2275,2285-2286,2288-2291,2295-2301,2304-2327,2337,2357-2359,2361-2364,2366,2374-2386,2404,2414-2415,2421-2422,2426,2432-2434,2444-2445,2447,2453-2461,2467,2492-2505,2520-2524,2545,2563-2565,2569 Modified: branches/1.1/bin/varnishlog/varnishlog.c =================================================================== --- branches/1.1/bin/varnishlog/varnishlog.c 2008-03-08 15:43:00 UTC (rev 2570) +++ branches/1.1/bin/varnishlog/varnishlog.c 2008-03-08 15:43:28 UTC (rev 2571) @@ -82,6 +82,7 @@ static struct vsb *ob[65536]; static unsigned char flg[65536]; +static enum shmlogtag last[65536]; #define F_INVCL (1 << 0) #define F_MATCH (1 << 1) @@ -89,6 +90,18 @@ static regex_t match_re; static void +h_order_finish(int fd) +{ + + vsb_finish(ob[fd]); + if (vsb_len(ob[fd]) > 1 && + (match_tag == -1 || flg[fd] & F_MATCH)) + printf("%s\n", vsb_data(ob[fd])); + flg[fd] &= ~F_MATCH; + vsb_clear(ob[fd]); +} + +static void clean_order(void) { unsigned u; @@ -108,9 +121,13 @@ static int h_order(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr) { + char type; (void)priv; + type = (spec & VSL_S_CLIENT) ? 'c' : + (spec & VSL_S_BACKEND) ? 'b' : '-'; + if (!(spec & (VSL_S_CLIENT|VSL_S_BACKEND))) { if (!b_flag && !c_flag) VSL_H_Print(stdout, tag, fd, len, spec, ptr); @@ -123,6 +140,27 @@ if (tag == match_tag && !regexec(&match_re, ptr, 0, NULL, 0)) flg[fd] |= F_MATCH; + + if ((tag == SLT_BackendOpen || tag == SLT_SessionOpen || + (tag == SLT_ReqStart && + last[fd] != SLT_SessionOpen && + last[fd] != SLT_VCL_acl) || + (tag == SLT_BackendXID && + last[fd] != SLT_BackendOpen)) && + vsb_len(ob[fd]) != 0) { + /* + * This is the start of a new request, yet we haven't seen + * the end of the previous one. Spit it out anyway before + * starting on the new one. + */ + if (last[fd] != SLT_SessionClose) + vsb_printf(ob[fd], "%5d %-12s %c %s\n", + fd, "Interrupted", type, VSL_tags[tag]); + h_order_finish(fd); + } + + last[fd] = tag; + switch (tag) { case SLT_VCL_call: if (flg[fd] & F_INVCL) @@ -130,10 +168,7 @@ else flg[fd] |= F_INVCL; vsb_printf(ob[fd], "%5d %-12s %c %.*s", - fd, VSL_tags[tag], - ((spec & VSL_S_CLIENT) ? 'c' : \ - (spec & VSL_S_BACKEND) ? 'b' : '-'), - len, ptr); + fd, VSL_tags[tag], type, len, ptr); return (0); case SLT_VCL_trace: case SLT_VCL_return: @@ -151,20 +186,13 @@ flg[fd] &= ~F_INVCL; } vsb_printf(ob[fd], "%5d %-12s %c %.*s\n", - fd, VSL_tags[tag], - ((spec & VSL_S_CLIENT) ? 'c' : (spec & VSL_S_BACKEND) ? 'b' : '-'), - len, ptr); + fd, VSL_tags[tag], type, len, ptr); switch (tag) { case SLT_ReqEnd: case SLT_BackendClose: case SLT_BackendReuse: case SLT_StatSess: - vsb_finish(ob[fd]); - if (vsb_len(ob[fd]) > 1 && - (match_tag == -1 || flg[fd] & F_MATCH)) - printf("%s\n", vsb_data(ob[fd])); - flg[fd] &= ~F_MATCH; - vsb_clear(ob[fd]); + h_order_finish(fd); break; default: break; From des at projects.linpro.no Sat Mar 8 16:55:22 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sat, 8 Mar 2008 17:55:22 +0100 (CET) Subject: r2572 - in trunk/varnish-cache: bin/varnishlog include lib/libvarnishapi Message-ID: <20080308165522.701331EC436@projects.linpro.no> Author: des Date: 2008-03-08 17:55:22 +0100 (Sat, 08 Mar 2008) New Revision: 2572 Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.1 trunk/varnish-cache/include/varnishapi.h trunk/varnish-cache/lib/libvarnishapi/shmlog.c Log: Add a -s option which specifies a number of entries to skip. Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.1 =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.1 2008-03-08 15:43:28 UTC (rev 2571) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.1 2008-03-08 16:55:22 UTC (rev 2572) @@ -28,7 +28,7 @@ .\" .\" $Id$ .\" -.Dd November 8, 2007 +.Dd March 8, 2008 .Dt VARNISHLOG 1 .Os .Sh NAME @@ -48,6 +48,7 @@ .Op Fl o .Op Fl P Ar file .Op Fl r Ar file +.Op Fl s Ar num .Op Fl V .Op Fl w Ar file .Op Fl X Ar regex @@ -126,6 +127,10 @@ Read log entries from .Ar file instead of shared memory. +.It Fl s Ar num +Skip the first +.Ar num +log records. .It Fl V Display the version number and exit. .It Fl w Ar file Modified: trunk/varnish-cache/include/varnishapi.h =================================================================== --- trunk/varnish-cache/include/varnishapi.h 2008-03-08 15:43:28 UTC (rev 2571) +++ trunk/varnish-cache/include/varnishapi.h 2008-03-08 16:55:22 UTC (rev 2572) @@ -44,8 +44,8 @@ typedef int vsl_handler(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr); #define VSL_S_CLIENT (1 << 0) #define VSL_S_BACKEND (1 << 1) -#define VSL_ARGS "bCcdI:i:r:X:x:" -#define VSL_USAGE "[-bCcd] [-i tag] [-I regexp] [-r file] [-X regexp] [-x tag]" +#define VSL_ARGS "bCcdI:i:r:s:X:x:" +#define VSL_USAGE "[-bCcd] [-i tag] [-I regexp] [-r file] [-s skip] [-X regexp] [-x tag]" vsl_handler VSL_H_Print; struct VSL_data; struct VSL_data *VSL_New(void); Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2008-03-08 15:43:28 UTC (rev 2571) +++ trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2008-03-08 16:55:22 UTC (rev 2572) @@ -85,6 +85,8 @@ int regflags; regex_t *regincl; regex_t *regexcl; + + unsigned long skip; }; #ifndef MAP_HASSEMAPHORE @@ -292,6 +294,10 @@ default: break; } + if (vd->skip) { + --vd->skip; + continue; + } if (vd->map[p[SHMLOG_TAG]] & M_SELECT) { *pp = p; return (1); @@ -478,6 +484,26 @@ /*--------------------------------------------------------------------*/ +static int +vsl_s_arg(struct VSL_data *vd, const char *opt) +{ + char *end; + + CHECK_OBJ_NOTNULL(vd, VSL_MAGIC); + if (*opt == '\0') { + fprintf(stderr, "number required for -s\n"); + return (-1); + } + vd->skip = strtoul(opt, &end, 10); + if (*end != '\0') { + fprintf(stderr, "invalid number for -s\n"); + return (-1); + } + return (1); +} + +/*--------------------------------------------------------------------*/ + int VSL_Arg(struct VSL_data *vd, int arg, const char *opt) { @@ -491,6 +517,7 @@ case 'r': return (vsl_r_arg(vd, opt)); case 'I': case 'X': return (vsl_IX_arg(vd, opt, arg)); case 'C': vd->regflags = REG_ICASE; return (1); + case 's': return (vsl_s_arg(vd, opt)); default: return (0); } From des at projects.linpro.no Sat Mar 8 16:56:56 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sat, 8 Mar 2008 17:56:56 +0100 (CET) Subject: r2573 - in branches/1.2: . bin/varnishlog include lib/libvarnishapi Message-ID: <20080308165656.37D571EC433@projects.linpro.no> Author: des Date: 2008-03-08 17:56:55 +0100 (Sat, 08 Mar 2008) New Revision: 2573 Modified: branches/1.2/ branches/1.2/bin/varnishlog/varnishlog.1 branches/1.2/include/varnishapi.h branches/1.2/lib/libvarnishapi/shmlog.c Log: Merged revisions 2572 via svnmerge from svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache ........ r2572 | des | 2008-03-08 17:55:22 +0100 (Sat, 08 Mar 2008) | 2 lines Add a -s option which specifies a number of entries to skip. ........ Property changes on: branches/1.2 ___________________________________________________________________ Name: svnmerge-integrated - /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317,2319,2321-2327,2337,2358,2362-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2522-2524,2545,2563-2565,2569 + /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317,2319,2321-2327,2337,2358,2362-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2522-2524,2545,2563-2565,2569,2572 Modified: branches/1.2/bin/varnishlog/varnishlog.1 =================================================================== --- branches/1.2/bin/varnishlog/varnishlog.1 2008-03-08 16:55:22 UTC (rev 2572) +++ branches/1.2/bin/varnishlog/varnishlog.1 2008-03-08 16:56:55 UTC (rev 2573) @@ -28,7 +28,7 @@ .\" .\" $Id$ .\" -.Dd November 8, 2007 +.Dd March 8, 2008 .Dt VARNISHLOG 1 .Os .Sh NAME @@ -48,6 +48,7 @@ .Op Fl o .Op Fl P Ar file .Op Fl r Ar file +.Op Fl s Ar num .Op Fl V .Op Fl w Ar file .Op Fl X Ar regex @@ -126,6 +127,10 @@ Read log entries from .Ar file instead of shared memory. +.It Fl s Ar num +Skip the first +.Ar num +log records. .It Fl V Display the version number and exit. .It Fl w Ar file Modified: branches/1.2/include/varnishapi.h =================================================================== --- branches/1.2/include/varnishapi.h 2008-03-08 16:55:22 UTC (rev 2572) +++ branches/1.2/include/varnishapi.h 2008-03-08 16:56:55 UTC (rev 2573) @@ -44,8 +44,8 @@ typedef int vsl_handler(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr); #define VSL_S_CLIENT (1 << 0) #define VSL_S_BACKEND (1 << 1) -#define VSL_ARGS "bCcdI:i:r:X:x:" -#define VSL_USAGE "[-bCcd] [-i tag] [-I regexp] [-r file] [-X regexp] [-x tag]" +#define VSL_ARGS "bCcdI:i:r:s:X:x:" +#define VSL_USAGE "[-bCcd] [-i tag] [-I regexp] [-r file] [-s skip] [-X regexp] [-x tag]" vsl_handler VSL_H_Print; struct VSL_data; struct VSL_data *VSL_New(void); Modified: branches/1.2/lib/libvarnishapi/shmlog.c =================================================================== --- branches/1.2/lib/libvarnishapi/shmlog.c 2008-03-08 16:55:22 UTC (rev 2572) +++ branches/1.2/lib/libvarnishapi/shmlog.c 2008-03-08 16:56:55 UTC (rev 2573) @@ -85,6 +85,8 @@ int regflags; regex_t *regincl; regex_t *regexcl; + + unsigned long skip; }; #ifndef MAP_HASSEMAPHORE @@ -289,6 +291,10 @@ default: break; } + if (vd->skip) { + --vd->skip; + continue; + } if (vd->map[p[0]] & M_SELECT) { *pp = p; return (1); @@ -472,6 +478,26 @@ /*--------------------------------------------------------------------*/ +static int +vsl_s_arg(struct VSL_data *vd, const char *opt) +{ + char *end; + + CHECK_OBJ_NOTNULL(vd, VSL_MAGIC); + if (*opt == '\0') { + fprintf(stderr, "number required for -s\n"); + return (-1); + } + vd->skip = strtoul(opt, &end, 10); + if (*end != '\0') { + fprintf(stderr, "invalid number for -s\n"); + return (-1); + } + return (1); +} + +/*--------------------------------------------------------------------*/ + int VSL_Arg(struct VSL_data *vd, int arg, const char *opt) { @@ -485,6 +511,7 @@ case 'r': return (vsl_r_arg(vd, opt)); case 'I': case 'X': return (vsl_IX_arg(vd, opt, arg)); case 'C': vd->regflags = REG_ICASE; return (1); + case 's': return (vsl_s_arg(vd, opt)); default: return (0); } From des at projects.linpro.no Sat Mar 8 16:59:39 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sat, 8 Mar 2008 17:59:39 +0100 (CET) Subject: r2574 - in branches/1.1: . bin/varnishlog include lib/libvarnishapi Message-ID: <20080308165939.35E381EC433@projects.linpro.no> Author: des Date: 2008-03-08 17:59:38 +0100 (Sat, 08 Mar 2008) New Revision: 2574 Modified: branches/1.1/ branches/1.1/bin/varnishlog/varnishlog.1 branches/1.1/include/varnishapi.h branches/1.1/lib/libvarnishapi/shmlog.c Log: Merged revisions 2572 via svnmerge from svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache ........ r2572 | des | 2008-03-08 17:55:22 +0100 (Sat, 08 Mar 2008) | 2 lines Add a -s option which specifies a number of entries to skip. ........ Property changes on: branches/1.1 ___________________________________________________________________ Name: svnmerge-integrated - /trunk/varnish-cache:1-1722,1727-1729,1733,1738,1743-1777,1779-1798,1800-1815,1817,1819,1823,1830-1838,1846,1853-1855,1857-1859,1862,1865-1868,1871-1880,1883-1884,1886,1888-1889,1896,1898,1902-1905,1907,1909,1912-1916,1920-1928,1935-1939,1941-1949,1955,1957-1958,1967-1968,1970-1974,1976-1977,1984,1986-1989,1991-1998,2026,2031-2033,2057,2077-2080,2086,2088,2091,2097,2106-2107,2116,2133,2154,2173,2181,2206-2207,2211-2212,2215-2245,2256-2262,2270-2271,2275,2285-2286,2288-2291,2295-2301,2304-2327,2337,2357-2359,2361-2364,2366,2374-2386,2404,2414-2415,2421-2422,2426,2432-2434,2444-2445,2447,2453-2461,2467,2492-2505,2520-2524,2545,2563-2565,2569 + /trunk/varnish-cache:1-1722,1727-1729,1733,1738,1743-1777,1779-1798,1800-1815,1817,1819,1823,1830-1838,1846,1853-1855,1857-1859,1862,1865-1868,1871-1880,1883-1884,1886,1888-1889,1896,1898,1902-1905,1907,1909,1912-1916,1920-1928,1935-1939,1941-1949,1955,1957-1958,1967-1968,1970-1974,1976-1977,1984,1986-1989,1991-1998,2026,2031-2033,2057,2077-2080,2086,2088,2091,2097,2106-2107,2116,2133,2154,2173,2181,2206-2207,2211-2212,2215-2245,2256-2262,2270-2271,2275,2285-2286,2288-2291,2295-2301,2304-2327,2337,2357-2359,2361-2364,2366,2374-2386,2404,2414-2415,2421-2422,2426,2432-2434,2444-2445,2447,2453-2461,2467,2492-2505,2520-2524,2545,2563-2565,2569,2572 Modified: branches/1.1/bin/varnishlog/varnishlog.1 =================================================================== --- branches/1.1/bin/varnishlog/varnishlog.1 2008-03-08 16:56:55 UTC (rev 2573) +++ branches/1.1/bin/varnishlog/varnishlog.1 2008-03-08 16:59:38 UTC (rev 2574) @@ -28,7 +28,7 @@ .\" .\" $Id$ .\" -.Dd November 8, 2007 +.Dd March 8, 2008 .Dt VARNISHLOG 1 .Os .Sh NAME @@ -48,6 +48,7 @@ .Op Fl o .Op Fl P Ar file .Op Fl r Ar file +.Op Fl s Ar num .Op Fl V .Op Fl w Ar file .Op Fl X Ar regex @@ -126,6 +127,10 @@ Read log entries from .Ar file instead of shared memory. +.It Fl s Ar num +Skip the first +.Ar num +log records. .It Fl V Display the version number and exit. .It Fl w Ar file Modified: branches/1.1/include/varnishapi.h =================================================================== --- branches/1.1/include/varnishapi.h 2008-03-08 16:56:55 UTC (rev 2573) +++ branches/1.1/include/varnishapi.h 2008-03-08 16:59:38 UTC (rev 2574) @@ -44,8 +44,8 @@ typedef int vsl_handler(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr); #define VSL_S_CLIENT (1 << 0) #define VSL_S_BACKEND (1 << 1) -#define VSL_ARGS "bCcdI:i:r:X:x:" -#define VSL_USAGE "[-bCcd] [-i tag] [-I regexp] [-r file] [-X regexp] [-x tag]" +#define VSL_ARGS "bCcdI:i:r:s:X:x:" +#define VSL_USAGE "[-bCcd] [-i tag] [-I regexp] [-r file] [-s skip] [-X regexp] [-x tag]" vsl_handler VSL_H_Print; struct VSL_data; struct VSL_data *VSL_New(void); Modified: branches/1.1/lib/libvarnishapi/shmlog.c =================================================================== --- branches/1.1/lib/libvarnishapi/shmlog.c 2008-03-08 16:56:55 UTC (rev 2573) +++ branches/1.1/lib/libvarnishapi/shmlog.c 2008-03-08 16:59:38 UTC (rev 2574) @@ -85,6 +85,8 @@ int regflags; regex_t *regincl; regex_t *regexcl; + + unsigned long skip; }; #ifndef MAP_HASSEMAPHORE @@ -289,6 +291,10 @@ default: break; } + if (vd->skip) { + --vd->skip; + continue; + } if (vd->map[p[0]] & M_SELECT) { *pp = p; return (1); @@ -356,7 +362,7 @@ if (*ptr >= ' ' && *ptr <= '~') fprintf(fo, "%c", *ptr); else - fprintf(fo, "%%%02x", *ptr); + fprintf(fo, "%%%02x", (unsigned char)*ptr); ptr++; } fprintf(fo, "\"\n"); @@ -472,6 +478,26 @@ /*--------------------------------------------------------------------*/ +static int +vsl_s_arg(struct VSL_data *vd, const char *opt) +{ + char *end; + + CHECK_OBJ_NOTNULL(vd, VSL_MAGIC); + if (*opt == '\0') { + fprintf(stderr, "number required for -s\n"); + return (-1); + } + vd->skip = strtoul(opt, &end, 10); + if (*end != '\0') { + fprintf(stderr, "invalid number for -s\n"); + return (-1); + } + return (1); +} + +/*--------------------------------------------------------------------*/ + int VSL_Arg(struct VSL_data *vd, int arg, const char *opt) { @@ -485,6 +511,7 @@ case 'r': return (vsl_r_arg(vd, opt)); case 'I': case 'X': return (vsl_IX_arg(vd, opt, arg)); case 'C': vd->regflags = REG_ICASE; return (1); + case 's': return (vsl_s_arg(vd, opt)); default: return (0); } From des at projects.linpro.no Sun Mar 9 15:14:04 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 9 Mar 2008 16:14:04 +0100 (CET) Subject: r2575 - in trunk/varnish-cache: bin/varnishlog include lib/libvarnishapi Message-ID: <20080309151404.77B1A1EC418@projects.linpro.no> Author: des Date: 2008-03-09 16:14:04 +0100 (Sun, 09 Mar 2008) New Revision: 2575 Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.1 trunk/varnish-cache/include/varnishapi.h trunk/varnish-cache/lib/libvarnishapi/shmlog.c Log: Add -k option which specifies the number of log entries to keep. Along with -s, this allows varnishlog to be used to extract part of a log file, or partition a log file into smaller sections. Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.1 =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.1 2008-03-08 16:59:38 UTC (rev 2574) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.1 2008-03-09 15:14:04 UTC (rev 2575) @@ -28,7 +28,7 @@ .\" .\" $Id$ .\" -.Dd March 8, 2008 +.Dd March 9, 2008 .Dt VARNISHLOG 1 .Os .Sh NAME @@ -44,6 +44,7 @@ .Op Fl d .Op Fl I Ar regex .Op Fl i Ar tag +.Op Fl k Ar keep .Op Fl n Ar varnish_name .Op Fl o .Op Fl P Ar file @@ -108,6 +109,10 @@ nor .Fl i is specified, all log entries are included. +.It Fl k Ar num +Only show the first +.Nm num +log records. .It Fl n Specifies the name of the .Nm varnishd Modified: trunk/varnish-cache/include/varnishapi.h =================================================================== --- trunk/varnish-cache/include/varnishapi.h 2008-03-08 16:59:38 UTC (rev 2574) +++ trunk/varnish-cache/include/varnishapi.h 2008-03-09 15:14:04 UTC (rev 2575) @@ -44,8 +44,8 @@ typedef int vsl_handler(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr); #define VSL_S_CLIENT (1 << 0) #define VSL_S_BACKEND (1 << 1) -#define VSL_ARGS "bCcdI:i:r:s:X:x:" -#define VSL_USAGE "[-bCcd] [-i tag] [-I regexp] [-r file] [-s skip] [-X regexp] [-x tag]" +#define VSL_ARGS "bCcdI:i:k:r:s:X:x:" +#define VSL_USAGE "[-bCcd] [-i tag] [-I regexp] [-k keep] [-r file] [-s skip] [-X regexp] [-x tag]" vsl_handler VSL_H_Print; struct VSL_data; struct VSL_data *VSL_New(void); Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2008-03-08 16:59:38 UTC (rev 2574) +++ trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2008-03-09 15:14:04 UTC (rev 2575) @@ -87,6 +87,7 @@ regex_t *regexcl; unsigned long skip; + unsigned long keep; }; #ifndef MAP_HASSEMAPHORE @@ -297,6 +298,9 @@ if (vd->skip) { --vd->skip; continue; + } else if (vd->keep) { + if (--vd->keep == 0) + return (0); } if (vd->map[p[SHMLOG_TAG]] & M_SELECT) { *pp = p; @@ -501,7 +505,26 @@ } return (1); } +/*--------------------------------------------------------------------*/ +static int +vsl_k_arg(struct VSL_data *vd, const char *opt) +{ + char *end; + + CHECK_OBJ_NOTNULL(vd, VSL_MAGIC); + if (*opt == '\0') { + fprintf(stderr, "number required for -k\n"); + return (-1); + } + vd->keep = strtoul(opt, &end, 10); + if (*end != '\0') { + fprintf(stderr, "invalid number for -k\n"); + return (-1); + } + return (1); +} + /*--------------------------------------------------------------------*/ int @@ -518,6 +541,7 @@ case 'I': case 'X': return (vsl_IX_arg(vd, opt, arg)); case 'C': vd->regflags = REG_ICASE; return (1); case 's': return (vsl_s_arg(vd, opt)); + case 'k': return (vsl_k_arg(vd, opt)); default: return (0); } From des at projects.linpro.no Sun Mar 9 15:17:49 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 9 Mar 2008 16:17:49 +0100 (CET) Subject: r2576 - trunk/varnish-cache/bin/varnishreplay Message-ID: <20080309151749.983921EC40C@projects.linpro.no> Author: des Date: 2008-03-09 16:17:49 +0100 (Sun, 09 Mar 2008) New Revision: 2576 Modified: trunk/varnish-cache/bin/varnishreplay/varnishreplay.c Log: Include complete headers with each replayed request. Ignore SIGPIPE, otherwise varnishreplay will stop as soon as varnishd starts overflowing. Modified: trunk/varnish-cache/bin/varnishreplay/varnishreplay.c =================================================================== --- trunk/varnish-cache/bin/varnishreplay/varnishreplay.c 2008-03-09 15:14:04 UTC (rev 2575) +++ trunk/varnish-cache/bin/varnishreplay/varnishreplay.c 2008-03-09 15:17:49 UTC (rev 2576) @@ -30,6 +30,9 @@ #include "config.h" +#include +#include + #include #include #include @@ -173,7 +176,7 @@ while (fd >= newnthreads) newnthreads += newnthreads + 1; newthreads = realloc(newthreads, newnthreads * sizeof *newthreads); - assert(newthreads != NULL); + XXXAN(newthreads != NULL); memset(newthreads + nthreads, 0, (newnthreads - nthreads) * sizeof *newthreads); threads = newthreads; @@ -189,7 +192,7 @@ mailbox_destroy(&threads[fd]->mbox); freez(threads[fd]); } - thread_log(1, 0, "thread %p started", + thread_log(0, 0, "thread %p started", (void *)threads[fd]->thread_id); } return (threads[fd]); @@ -210,7 +213,7 @@ return; mailbox_close(&threads[fd]->mbox); pthread_join(threads[fd]->thread_id, NULL); - thread_log(1, 0, "thread %p stopped", + thread_log(0, 0, "thread %p stopped", (void *)threads[fd]->thread_id); mailbox_destroy(&threads[fd]->mbox); freez(threads[fd]); @@ -237,6 +240,7 @@ return (1); } +#if 0 static int isequal(const char *str, const char *reference, const char *end) { @@ -248,6 +252,7 @@ return (0); return (1); } +#endif /* * Returns a copy of the entire string with leading and trailing spaces @@ -404,6 +409,7 @@ line_len = read_line(&line, sock); if (line_len < 0) return (-1); + thread_log(2, 0, "< %.*s", line_len, line); end = line + line_len; if (line_len == 0) { freez(line); @@ -474,6 +480,8 @@ static void * replay_thread(void *arg) { + struct iovec iov[6]; + char space[1] = " ", crlf[2] = "\r\n"; struct thread *thr = arg; struct message *msg; enum shmlogtag tag; @@ -481,15 +489,21 @@ char *ptr; const char *end, *next; - char *df_H = NULL; /* %H, Protocol version */ - char *df_Host = NULL; /* %{Host}i */ - char *df_Uq = NULL; /* %U%q, URL path and query string */ - char *df_m = NULL; /* %m, Request method*/ - char *df_c = NULL; /* Connection info (keep-alive, close) */ + char *df_method = NULL; /* Request method*/ + char *df_proto = NULL; /* Protocol version */ + char *df_url = NULL; /* URL and query string */ + char *df_conn = NULL; /* Connection info (keep-alive, close) */ + char **df_hdr = NULL; /* Headers */ + size_t df_hdrsz = 0; /* Size of df_hdr */ + int df_nhdr = 0; /* Number of headers */ int bogus = 0; /* bogus request */ + int i; - int sock, reopen = 1; + int sock = -1, reopen = 1; + df_hdrsz = 16; + df_hdr = malloc(df_hdrsz * sizeof *df_hdr); + while ((msg = mailbox_get(&thr->mbox)) != NULL) { tag = msg->tag; len = msg->len; @@ -500,115 +514,134 @@ switch (tag) { case SLT_RxRequest: - if (df_m != NULL) + if (df_method != NULL) bogus = 1; else - df_m = trimline(ptr, end); + df_method = trimline(ptr, end); break; case SLT_RxURL: - if (df_Uq != NULL) + if (df_url != NULL) bogus = 1; else - df_Uq = trimline(ptr, end); + df_url = trimline(ptr, end); break; case SLT_RxProtocol: - if (df_H != NULL) + if (df_proto != NULL) bogus = 1; else - df_H = trimline(ptr, end); + df_proto = trimline(ptr, end); break; case SLT_RxHeader: - if (isprefix(ptr, "host:", end, &next)) - df_Host = trimline(next, end); + while (df_hdrsz <= df_nhdr) { + df_hdrsz *= 2; + df_hdr = realloc(df_hdr, df_hdrsz * sizeof *df_hdr); + XXXAN(df_hdr); + } + df_hdr[df_nhdr++] = trimline(ptr, end); if (isprefix(ptr, "connection:", end, &next)) - df_c = trimline(next, end); + df_conn = trimline(next, end); break; default: break; } + freez(msg->ptr); + freez(msg); + if (tag != SLT_ReqEnd) continue; - if (!df_m || !df_Uq || !df_H) + if (!df_method || !df_url || !df_proto) { bogus = 1; + } else if (strcmp(df_method, "GET") != 0 && strcmp(df_method, "HEAD") != 0) { + bogus = 1; + } else if (strcmp(df_proto, "HTTP/1.0") == 0) { + reopen = !(df_conn && strcasecmp(df_conn, "keep-alive") == 0); + } else if (strcmp(df_proto, "HTTP/1.1") == 0) { + reopen = (df_conn && strcasecmp(df_conn, "close") == 0); + } else { + bogus = 1; + } if (bogus) { thread_log(1, 0, "bogus"); } else { - /* If the method is supported (GET or HEAD), send the request out - * on the socket. If the socket needs reopening, reopen it first. - * When the request is sent, call the function for receiving - * the answer. - */ - if (!(strcmp(df_m, "GET") && strcmp(df_m, "HEAD"))) { - if (reopen) - sock = VSS_connect(addr_info); - reopen = 0; + if (sock == -1) { + thread_log(1, 0, "open"); + sock = VSS_connect(addr_info); + assert(sock != -1); + } - thread_log(1, 0, "%s %s %s", df_m, df_Uq, df_H); + thread_log(1, 0, "%s %s %s", df_method, df_url, df_proto); - write(sock, df_m, strlen(df_m)); - write(sock, " ", 1); - write(sock, df_Uq, strlen(df_Uq)); - write(sock, " ", 1); - write(sock, df_H, strlen(df_H)); - write(sock, " ", 1); - write(sock, "\r\n", 2); + iov[0].iov_base = df_method; + iov[0].iov_len = strlen(df_method); + iov[2].iov_base = df_url; + iov[2].iov_len = strlen(df_url); + iov[4].iov_base = df_proto; + iov[4].iov_len = strlen(df_proto); + iov[1].iov_base = iov[3].iov_base = space; + iov[1].iov_len = iov[3].iov_len = 1; + iov[5].iov_base = crlf; + iov[5].iov_len = 2; + if (writev(sock, iov, 6) == -1) { + thread_log(0, errno, "writev()"); + goto close; + } - if (strncmp(df_H, "HTTP/1.0", 8)) - reopen = 1; - - write(sock, "Host: ", 6); - if (df_Host) { - thread_log(1, 0, "Host: %s", df_Host); - write(sock, df_Host, strlen(df_Host)); + for (i = 0; i < df_nhdr; ++i) { + thread_log(2, 0, "%d %s", i, df_hdr[i]); + iov[0].iov_base = df_hdr[i]; + iov[0].iov_len = strlen(df_hdr[i]); + iov[1].iov_base = crlf; + iov[1].iov_len = 2; + if (writev(sock, iov, 2) == -1) { + thread_log(0, errno, "writev()"); + goto close; } - write(sock, "\r\n", 2); - if (df_c) { - thread_log(1, 0, "Connection: %s", df_c); - write(sock, "Connection: ", 12); - write(sock, df_c, strlen(df_c)); - write(sock, "\r\n", 2); - if (isequal(df_c, "keep-alive", df_c + strlen(df_c))) - reopen = 0; - } - write(sock, "\r\n", 2); - if (!reopen) - reopen = receive_response(sock); - if (reopen) - close(sock); } + if (write(sock, crlf, 2) == -1) { + thread_log(0, errno, "writev()"); + goto close; + } + if (receive_response(sock) || reopen) { +close: + thread_log(1, 0, "close"); + close(sock); + sock = -1; + } } /* clean up */ - freez(msg->ptr); - freez(msg); - freez(df_H); - freez(df_Host); - freez(df_Uq); - freez(df_m); - freez(df_c); + freez(df_method); + freez(df_url); + freez(df_proto); + freez(df_conn); + while (df_nhdr) { + --df_nhdr; + freez(df_hdr[df_nhdr]); + } bogus = 0; } /* leftovers */ - freez(msg->ptr); - freez(msg); - freez(df_H); - freez(df_Host); - freez(df_Uq); - freez(df_m); - freez(df_c); + freez(df_method); + freez(df_url); + freez(df_proto); + freez(df_conn); + while (df_nhdr) { + --df_nhdr; + freez(df_hdr[df_nhdr]); + } + freez(df_hdr); return (0); } - static int gen_traffic(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr) @@ -616,6 +649,7 @@ struct thread *thr; const char *end; struct message *msg; + int i; (void)priv; @@ -624,7 +658,7 @@ if (fd == 0 || !(spec & VSL_S_CLIENT)) return (0); - thread_log(2, 0, "%d %s", fd, VSL_tags[tag]); + thread_log(3, 0, "%d %s", fd, VSL_tags[tag]); thr = thread_get(fd, replay_thread); msg = malloc(sizeof (struct message)); msg->tag = tag; @@ -680,6 +714,8 @@ addr_info = init_connection(address); + signal(SIGPIPE, SIG_IGN); + while (VSL_Dispatch(vd, gen_traffic, NULL) == 0) /* nothing */ ; thread_close(0); From des at projects.linpro.no Sun Mar 9 15:24:37 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 9 Mar 2008 16:24:37 +0100 (CET) Subject: r2577 - trunk/varnish-cache/bin/varnishreplay Message-ID: <20080309152437.A881A1EC418@projects.linpro.no> Author: des Date: 2008-03-09 16:24:37 +0100 (Sun, 09 Mar 2008) New Revision: 2577 Modified: trunk/varnish-cache/bin/varnishreplay/varnishreplay.c Log: Braino in previous commit. Modified: trunk/varnish-cache/bin/varnishreplay/varnishreplay.c =================================================================== --- trunk/varnish-cache/bin/varnishreplay/varnishreplay.c 2008-03-09 15:17:49 UTC (rev 2576) +++ trunk/varnish-cache/bin/varnishreplay/varnishreplay.c 2008-03-09 15:24:37 UTC (rev 2577) @@ -649,7 +649,6 @@ struct thread *thr; const char *end; struct message *msg; - int i; (void)priv; From des at projects.linpro.no Sun Mar 9 15:26:32 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 9 Mar 2008 16:26:32 +0100 (CET) Subject: r2578 - in branches/1.2: . bin/varnishlog bin/varnishreplay include lib/libvarnishapi Message-ID: <20080309152632.185DF1EC40C@projects.linpro.no> Author: des Date: 2008-03-09 16:26:31 +0100 (Sun, 09 Mar 2008) New Revision: 2578 Modified: branches/1.2/ branches/1.2/bin/varnishlog/varnishlog.1 branches/1.2/bin/varnishreplay/varnishreplay.c branches/1.2/include/varnishapi.h branches/1.2/lib/libvarnishapi/shmlog.c Log: Merged revisions 2575-2577 via svnmerge from svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache ........ r2575 | des | 2008-03-09 16:14:04 +0100 (Sun, 09 Mar 2008) | 4 lines Add -k option which specifies the number of log entries to keep. Along with -s, this allows varnishlog to be used to extract part of a log file, or partition a log file into smaller sections. ........ r2576 | des | 2008-03-09 16:17:49 +0100 (Sun, 09 Mar 2008) | 4 lines Include complete headers with each replayed request. Ignore SIGPIPE, otherwise varnishreplay will stop as soon as varnishd starts overflowing. ........ r2577 | des | 2008-03-09 16:24:37 +0100 (Sun, 09 Mar 2008) | 2 lines Braino in previous commit. ........ Property changes on: branches/1.2 ___________________________________________________________________ Name: svnmerge-integrated - /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317,2319,2321-2327,2337,2358,2362-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2522-2524,2545,2563-2565,2569,2572 + /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317,2319,2321-2327,2337,2358,2362-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2522-2524,2545,2563-2565,2569,2572,2575-2577 Modified: branches/1.2/bin/varnishlog/varnishlog.1 =================================================================== --- branches/1.2/bin/varnishlog/varnishlog.1 2008-03-09 15:24:37 UTC (rev 2577) +++ branches/1.2/bin/varnishlog/varnishlog.1 2008-03-09 15:26:31 UTC (rev 2578) @@ -28,7 +28,7 @@ .\" .\" $Id$ .\" -.Dd March 8, 2008 +.Dd March 9, 2008 .Dt VARNISHLOG 1 .Os .Sh NAME @@ -44,6 +44,7 @@ .Op Fl d .Op Fl I Ar regex .Op Fl i Ar tag +.Op Fl k Ar keep .Op Fl n Ar varnish_name .Op Fl o .Op Fl P Ar file @@ -108,6 +109,10 @@ nor .Fl i is specified, all log entries are included. +.It Fl k Ar num +Only show the first +.Nm num +log records. .It Fl n Specifies the name of the .Nm varnishd Modified: branches/1.2/bin/varnishreplay/varnishreplay.c =================================================================== --- branches/1.2/bin/varnishreplay/varnishreplay.c 2008-03-09 15:24:37 UTC (rev 2577) +++ branches/1.2/bin/varnishreplay/varnishreplay.c 2008-03-09 15:26:31 UTC (rev 2578) @@ -30,6 +30,9 @@ #include "config.h" +#include +#include + #include #include #include @@ -173,7 +176,7 @@ while (fd >= newnthreads) newnthreads += newnthreads + 1; newthreads = realloc(newthreads, newnthreads * sizeof *newthreads); - assert(newthreads != NULL); + XXXAN(newthreads != NULL); memset(newthreads + nthreads, 0, (newnthreads - nthreads) * sizeof *newthreads); threads = newthreads; @@ -189,7 +192,7 @@ mailbox_destroy(&threads[fd]->mbox); freez(threads[fd]); } - thread_log(1, 0, "thread %p started", + thread_log(0, 0, "thread %p started", (void *)threads[fd]->thread_id); } return (threads[fd]); @@ -210,7 +213,7 @@ return; mailbox_close(&threads[fd]->mbox); pthread_join(threads[fd]->thread_id, NULL); - thread_log(1, 0, "thread %p stopped", + thread_log(0, 0, "thread %p stopped", (void *)threads[fd]->thread_id); mailbox_destroy(&threads[fd]->mbox); freez(threads[fd]); @@ -237,6 +240,7 @@ return (1); } +#if 0 static int isequal(const char *str, const char *reference, const char *end) { @@ -248,6 +252,7 @@ return (0); return (1); } +#endif /* * Returns a copy of the entire string with leading and trailing spaces @@ -404,6 +409,7 @@ line_len = read_line(&line, sock); if (line_len < 0) return (-1); + thread_log(2, 0, "< %.*s", line_len, line); end = line + line_len; if (line_len == 0) { freez(line); @@ -474,6 +480,8 @@ static void * replay_thread(void *arg) { + struct iovec iov[6]; + char space[1] = " ", crlf[2] = "\r\n"; struct thread *thr = arg; struct message *msg; enum shmlogtag tag; @@ -481,15 +489,21 @@ char *ptr; const char *end, *next; - char *df_H = NULL; /* %H, Protocol version */ - char *df_Host = NULL; /* %{Host}i */ - char *df_Uq = NULL; /* %U%q, URL path and query string */ - char *df_m = NULL; /* %m, Request method*/ - char *df_c = NULL; /* Connection info (keep-alive, close) */ + char *df_method = NULL; /* Request method*/ + char *df_proto = NULL; /* Protocol version */ + char *df_url = NULL; /* URL and query string */ + char *df_conn = NULL; /* Connection info (keep-alive, close) */ + char **df_hdr = NULL; /* Headers */ + size_t df_hdrsz = 0; /* Size of df_hdr */ + int df_nhdr = 0; /* Number of headers */ int bogus = 0; /* bogus request */ + int i; - int sock, reopen = 1; + int sock = -1, reopen = 1; + df_hdrsz = 16; + df_hdr = malloc(df_hdrsz * sizeof *df_hdr); + while ((msg = mailbox_get(&thr->mbox)) != NULL) { tag = msg->tag; len = msg->len; @@ -500,115 +514,134 @@ switch (tag) { case SLT_RxRequest: - if (df_m != NULL) + if (df_method != NULL) bogus = 1; else - df_m = trimline(ptr, end); + df_method = trimline(ptr, end); break; case SLT_RxURL: - if (df_Uq != NULL) + if (df_url != NULL) bogus = 1; else - df_Uq = trimline(ptr, end); + df_url = trimline(ptr, end); break; case SLT_RxProtocol: - if (df_H != NULL) + if (df_proto != NULL) bogus = 1; else - df_H = trimline(ptr, end); + df_proto = trimline(ptr, end); break; case SLT_RxHeader: - if (isprefix(ptr, "host:", end, &next)) - df_Host = trimline(next, end); + while (df_hdrsz <= df_nhdr) { + df_hdrsz *= 2; + df_hdr = realloc(df_hdr, df_hdrsz * sizeof *df_hdr); + XXXAN(df_hdr); + } + df_hdr[df_nhdr++] = trimline(ptr, end); if (isprefix(ptr, "connection:", end, &next)) - df_c = trimline(next, end); + df_conn = trimline(next, end); break; default: break; } + freez(msg->ptr); + freez(msg); + if (tag != SLT_ReqEnd) continue; - if (!df_m || !df_Uq || !df_H) + if (!df_method || !df_url || !df_proto) { bogus = 1; + } else if (strcmp(df_method, "GET") != 0 && strcmp(df_method, "HEAD") != 0) { + bogus = 1; + } else if (strcmp(df_proto, "HTTP/1.0") == 0) { + reopen = !(df_conn && strcasecmp(df_conn, "keep-alive") == 0); + } else if (strcmp(df_proto, "HTTP/1.1") == 0) { + reopen = (df_conn && strcasecmp(df_conn, "close") == 0); + } else { + bogus = 1; + } if (bogus) { thread_log(1, 0, "bogus"); } else { - /* If the method is supported (GET or HEAD), send the request out - * on the socket. If the socket needs reopening, reopen it first. - * When the request is sent, call the function for receiving - * the answer. - */ - if (!(strcmp(df_m, "GET") && strcmp(df_m, "HEAD"))) { - if (reopen) - sock = VSS_connect(addr_info); - reopen = 0; + if (sock == -1) { + thread_log(1, 0, "open"); + sock = VSS_connect(addr_info); + assert(sock != -1); + } - thread_log(1, 0, "%s %s %s", df_m, df_Uq, df_H); + thread_log(1, 0, "%s %s %s", df_method, df_url, df_proto); - write(sock, df_m, strlen(df_m)); - write(sock, " ", 1); - write(sock, df_Uq, strlen(df_Uq)); - write(sock, " ", 1); - write(sock, df_H, strlen(df_H)); - write(sock, " ", 1); - write(sock, "\r\n", 2); + iov[0].iov_base = df_method; + iov[0].iov_len = strlen(df_method); + iov[2].iov_base = df_url; + iov[2].iov_len = strlen(df_url); + iov[4].iov_base = df_proto; + iov[4].iov_len = strlen(df_proto); + iov[1].iov_base = iov[3].iov_base = space; + iov[1].iov_len = iov[3].iov_len = 1; + iov[5].iov_base = crlf; + iov[5].iov_len = 2; + if (writev(sock, iov, 6) == -1) { + thread_log(0, errno, "writev()"); + goto close; + } - if (strncmp(df_H, "HTTP/1.0", 8)) - reopen = 1; - - write(sock, "Host: ", 6); - if (df_Host) { - thread_log(1, 0, "Host: %s", df_Host); - write(sock, df_Host, strlen(df_Host)); + for (i = 0; i < df_nhdr; ++i) { + thread_log(2, 0, "%d %s", i, df_hdr[i]); + iov[0].iov_base = df_hdr[i]; + iov[0].iov_len = strlen(df_hdr[i]); + iov[1].iov_base = crlf; + iov[1].iov_len = 2; + if (writev(sock, iov, 2) == -1) { + thread_log(0, errno, "writev()"); + goto close; } - write(sock, "\r\n", 2); - if (df_c) { - thread_log(1, 0, "Connection: %s", df_c); - write(sock, "Connection: ", 12); - write(sock, df_c, strlen(df_c)); - write(sock, "\r\n", 2); - if (isequal(df_c, "keep-alive", df_c + strlen(df_c))) - reopen = 0; - } - write(sock, "\r\n", 2); - if (!reopen) - reopen = receive_response(sock); - if (reopen) - close(sock); } + if (write(sock, crlf, 2) == -1) { + thread_log(0, errno, "writev()"); + goto close; + } + if (receive_response(sock) || reopen) { +close: + thread_log(1, 0, "close"); + close(sock); + sock = -1; + } } /* clean up */ - freez(msg->ptr); - freez(msg); - freez(df_H); - freez(df_Host); - freez(df_Uq); - freez(df_m); - freez(df_c); + freez(df_method); + freez(df_url); + freez(df_proto); + freez(df_conn); + while (df_nhdr) { + --df_nhdr; + freez(df_hdr[df_nhdr]); + } bogus = 0; } /* leftovers */ - freez(msg->ptr); - freez(msg); - freez(df_H); - freez(df_Host); - freez(df_Uq); - freez(df_m); - freez(df_c); + freez(df_method); + freez(df_url); + freez(df_proto); + freez(df_conn); + while (df_nhdr) { + --df_nhdr; + freez(df_hdr[df_nhdr]); + } + freez(df_hdr); return (0); } - static int gen_traffic(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr) @@ -624,7 +657,7 @@ if (fd == 0 || !(spec & VSL_S_CLIENT)) return (0); - thread_log(2, 0, "%d %s", fd, VSL_tags[tag]); + thread_log(3, 0, "%d %s", fd, VSL_tags[tag]); thr = thread_get(fd, replay_thread); msg = malloc(sizeof (struct message)); msg->tag = tag; @@ -680,6 +713,8 @@ addr_info = init_connection(address); + signal(SIGPIPE, SIG_IGN); + while (VSL_Dispatch(vd, gen_traffic, NULL) == 0) /* nothing */ ; thread_close(0); Modified: branches/1.2/include/varnishapi.h =================================================================== --- branches/1.2/include/varnishapi.h 2008-03-09 15:24:37 UTC (rev 2577) +++ branches/1.2/include/varnishapi.h 2008-03-09 15:26:31 UTC (rev 2578) @@ -44,8 +44,8 @@ typedef int vsl_handler(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr); #define VSL_S_CLIENT (1 << 0) #define VSL_S_BACKEND (1 << 1) -#define VSL_ARGS "bCcdI:i:r:s:X:x:" -#define VSL_USAGE "[-bCcd] [-i tag] [-I regexp] [-r file] [-s skip] [-X regexp] [-x tag]" +#define VSL_ARGS "bCcdI:i:k:r:s:X:x:" +#define VSL_USAGE "[-bCcd] [-i tag] [-I regexp] [-k keep] [-r file] [-s skip] [-X regexp] [-x tag]" vsl_handler VSL_H_Print; struct VSL_data; struct VSL_data *VSL_New(void); Modified: branches/1.2/lib/libvarnishapi/shmlog.c =================================================================== --- branches/1.2/lib/libvarnishapi/shmlog.c 2008-03-09 15:24:37 UTC (rev 2577) +++ branches/1.2/lib/libvarnishapi/shmlog.c 2008-03-09 15:26:31 UTC (rev 2578) @@ -87,6 +87,7 @@ regex_t *regexcl; unsigned long skip; + unsigned long keep; }; #ifndef MAP_HASSEMAPHORE @@ -294,6 +295,9 @@ if (vd->skip) { --vd->skip; continue; + } else if (vd->keep) { + if (--vd->keep == 0) + return (0); } if (vd->map[p[0]] & M_SELECT) { *pp = p; @@ -495,7 +499,26 @@ } return (1); } +/*--------------------------------------------------------------------*/ +static int +vsl_k_arg(struct VSL_data *vd, const char *opt) +{ + char *end; + + CHECK_OBJ_NOTNULL(vd, VSL_MAGIC); + if (*opt == '\0') { + fprintf(stderr, "number required for -k\n"); + return (-1); + } + vd->keep = strtoul(opt, &end, 10); + if (*end != '\0') { + fprintf(stderr, "invalid number for -k\n"); + return (-1); + } + return (1); +} + /*--------------------------------------------------------------------*/ int @@ -512,6 +535,7 @@ case 'I': case 'X': return (vsl_IX_arg(vd, opt, arg)); case 'C': vd->regflags = REG_ICASE; return (1); case 's': return (vsl_s_arg(vd, opt)); + case 'k': return (vsl_k_arg(vd, opt)); default: return (0); } From des at projects.linpro.no Sun Mar 9 15:26:55 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 9 Mar 2008 16:26:55 +0100 (CET) Subject: r2579 - in branches/1.1: . bin/varnishlog bin/varnishreplay include lib/libvarnishapi Message-ID: <20080309152655.4C77F1EC514@projects.linpro.no> Author: des Date: 2008-03-09 16:26:55 +0100 (Sun, 09 Mar 2008) New Revision: 2579 Modified: branches/1.1/ branches/1.1/bin/varnishlog/varnishlog.1 branches/1.1/bin/varnishreplay/varnishreplay.c branches/1.1/include/varnishapi.h branches/1.1/lib/libvarnishapi/shmlog.c Log: Merged revisions 2575-2577 via svnmerge from svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache ........ r2575 | des | 2008-03-09 16:14:04 +0100 (Sun, 09 Mar 2008) | 4 lines Add -k option which specifies the number of log entries to keep. Along with -s, this allows varnishlog to be used to extract part of a log file, or partition a log file into smaller sections. ........ r2576 | des | 2008-03-09 16:17:49 +0100 (Sun, 09 Mar 2008) | 4 lines Include complete headers with each replayed request. Ignore SIGPIPE, otherwise varnishreplay will stop as soon as varnishd starts overflowing. ........ r2577 | des | 2008-03-09 16:24:37 +0100 (Sun, 09 Mar 2008) | 2 lines Braino in previous commit. ........ Property changes on: branches/1.1 ___________________________________________________________________ Name: svnmerge-integrated - /trunk/varnish-cache:1-1722,1727-1729,1733,1738,1743-1777,1779-1798,1800-1815,1817,1819,1823,1830-1838,1846,1853-1855,1857-1859,1862,1865-1868,1871-1880,1883-1884,1886,1888-1889,1896,1898,1902-1905,1907,1909,1912-1916,1920-1928,1935-1939,1941-1949,1955,1957-1958,1967-1968,1970-1974,1976-1977,1984,1986-1989,1991-1998,2026,2031-2033,2057,2077-2080,2086,2088,2091,2097,2106-2107,2116,2133,2154,2173,2181,2206-2207,2211-2212,2215-2245,2256-2262,2270-2271,2275,2285-2286,2288-2291,2295-2301,2304-2327,2337,2357-2359,2361-2364,2366,2374-2386,2404,2414-2415,2421-2422,2426,2432-2434,2444-2445,2447,2453-2461,2467,2492-2505,2520-2524,2545,2563-2565,2569,2572 + /trunk/varnish-cache:1-1722,1727-1729,1733,1738,1743-1777,1779-1798,1800-1815,1817,1819,1823,1830-1838,1846,1853-1855,1857-1859,1862,1865-1868,1871-1880,1883-1884,1886,1888-1889,1896,1898,1902-1905,1907,1909,1912-1916,1920-1928,1935-1939,1941-1949,1955,1957-1958,1967-1968,1970-1974,1976-1977,1984,1986-1989,1991-1998,2026,2031-2033,2057,2077-2080,2086,2088,2091,2097,2106-2107,2116,2133,2154,2173,2181,2206-2207,2211-2212,2215-2245,2256-2262,2270-2271,2275,2285-2286,2288-2291,2295-2301,2304-2327,2337,2357-2359,2361-2364,2366,2374-2386,2404,2414-2415,2421-2422,2426,2432-2434,2444-2445,2447,2453-2461,2467,2492-2505,2520-2524,2545,2563-2565,2569,2572,2575-2577 Modified: branches/1.1/bin/varnishlog/varnishlog.1 =================================================================== --- branches/1.1/bin/varnishlog/varnishlog.1 2008-03-09 15:26:31 UTC (rev 2578) +++ branches/1.1/bin/varnishlog/varnishlog.1 2008-03-09 15:26:55 UTC (rev 2579) @@ -28,7 +28,7 @@ .\" .\" $Id$ .\" -.Dd March 8, 2008 +.Dd March 9, 2008 .Dt VARNISHLOG 1 .Os .Sh NAME @@ -44,6 +44,7 @@ .Op Fl d .Op Fl I Ar regex .Op Fl i Ar tag +.Op Fl k Ar keep .Op Fl n Ar varnish_name .Op Fl o .Op Fl P Ar file @@ -108,6 +109,10 @@ nor .Fl i is specified, all log entries are included. +.It Fl k Ar num +Only show the first +.Nm num +log records. .It Fl n Specifies the name of the .Nm varnishd Modified: branches/1.1/bin/varnishreplay/varnishreplay.c =================================================================== --- branches/1.1/bin/varnishreplay/varnishreplay.c 2008-03-09 15:26:31 UTC (rev 2578) +++ branches/1.1/bin/varnishreplay/varnishreplay.c 2008-03-09 15:26:55 UTC (rev 2579) @@ -30,6 +30,9 @@ #include "config.h" +#include +#include + #include #include #include @@ -172,7 +175,7 @@ while (fd >= newnthreads) newnthreads += newnthreads + 1; newthreads = realloc(newthreads, newnthreads * sizeof *newthreads); - assert(newthreads != NULL); + XXXAN(newthreads != NULL); memset(newthreads + nthreads, 0, (newnthreads - nthreads) * sizeof *newthreads); threads = newthreads; @@ -188,7 +191,7 @@ mailbox_destroy(&threads[fd]->mbox); freez(threads[fd]); } - thread_log(1, 0, "thread %p started", + thread_log(0, 0, "thread %p started", (void *)threads[fd]->thread_id); } return (threads[fd]); @@ -209,7 +212,7 @@ return; mailbox_close(&threads[fd]->mbox); pthread_join(threads[fd]->thread_id, NULL); - thread_log(1, 0, "thread %p stopped", + thread_log(0, 0, "thread %p stopped", (void *)threads[fd]->thread_id); mailbox_destroy(&threads[fd]->mbox); freez(threads[fd]); @@ -236,6 +239,7 @@ return (1); } +#if 0 static int isequal(const char *str, const char *reference, const char *end) { @@ -247,6 +251,7 @@ return (0); return (1); } +#endif /* * Returns a copy of the entire string with leading and trailing spaces @@ -403,6 +408,7 @@ line_len = read_line(&line, sock); if (line_len < 0) return (-1); + thread_log(2, 0, "< %.*s", line_len, line); end = line + line_len; if (line_len == 0) { freez(line); @@ -473,6 +479,8 @@ static void * replay_thread(void *arg) { + struct iovec iov[6]; + char space[1] = " ", crlf[2] = "\r\n"; struct thread *thr = arg; struct message *msg; enum shmlogtag tag; @@ -480,15 +488,21 @@ char *ptr; const char *end, *next; - char *df_H = NULL; /* %H, Protocol version */ - char *df_Host = NULL; /* %{Host}i */ - char *df_Uq = NULL; /* %U%q, URL path and query string */ - char *df_m = NULL; /* %m, Request method*/ - char *df_c = NULL; /* Connection info (keep-alive, close) */ + char *df_method = NULL; /* Request method*/ + char *df_proto = NULL; /* Protocol version */ + char *df_url = NULL; /* URL and query string */ + char *df_conn = NULL; /* Connection info (keep-alive, close) */ + char **df_hdr = NULL; /* Headers */ + size_t df_hdrsz = 0; /* Size of df_hdr */ + int df_nhdr = 0; /* Number of headers */ int bogus = 0; /* bogus request */ + int i; - int sock, reopen = 1; + int sock = -1, reopen = 1; + df_hdrsz = 16; + df_hdr = malloc(df_hdrsz * sizeof *df_hdr); + while ((msg = mailbox_get(&thr->mbox)) != NULL) { tag = msg->tag; len = msg->len; @@ -499,115 +513,134 @@ switch (tag) { case SLT_RxRequest: - if (df_m != NULL) + if (df_method != NULL) bogus = 1; else - df_m = trimline(ptr, end); + df_method = trimline(ptr, end); break; case SLT_RxURL: - if (df_Uq != NULL) + if (df_url != NULL) bogus = 1; else - df_Uq = trimline(ptr, end); + df_url = trimline(ptr, end); break; case SLT_RxProtocol: - if (df_H != NULL) + if (df_proto != NULL) bogus = 1; else - df_H = trimline(ptr, end); + df_proto = trimline(ptr, end); break; case SLT_RxHeader: - if (isprefix(ptr, "host:", end, &next)) - df_Host = trimline(next, end); + while (df_hdrsz <= df_nhdr) { + df_hdrsz *= 2; + df_hdr = realloc(df_hdr, df_hdrsz * sizeof *df_hdr); + XXXAN(df_hdr); + } + df_hdr[df_nhdr++] = trimline(ptr, end); if (isprefix(ptr, "connection:", end, &next)) - df_c = trimline(next, end); + df_conn = trimline(next, end); break; default: break; } + freez(msg->ptr); + freez(msg); + if (tag != SLT_ReqEnd) continue; - if (!df_m || !df_Uq || !df_H) + if (!df_method || !df_url || !df_proto) { bogus = 1; + } else if (strcmp(df_method, "GET") != 0 && strcmp(df_method, "HEAD") != 0) { + bogus = 1; + } else if (strcmp(df_proto, "HTTP/1.0") == 0) { + reopen = !(df_conn && strcasecmp(df_conn, "keep-alive") == 0); + } else if (strcmp(df_proto, "HTTP/1.1") == 0) { + reopen = (df_conn && strcasecmp(df_conn, "close") == 0); + } else { + bogus = 1; + } if (bogus) { thread_log(1, 0, "bogus"); } else { - /* If the method is supported (GET or HEAD), send the request out - * on the socket. If the socket needs reopening, reopen it first. - * When the request is sent, call the function for receiving - * the answer. - */ - if (!(strcmp(df_m, "GET") && strcmp(df_m, "HEAD"))) { - if (reopen) - sock = VSS_connect(addr_info); - reopen = 0; + if (sock == -1) { + thread_log(1, 0, "open"); + sock = VSS_connect(addr_info); + assert(sock != -1); + } - thread_log(1, 0, "%s %s %s", df_m, df_Uq, df_H); + thread_log(1, 0, "%s %s %s", df_method, df_url, df_proto); - write(sock, df_m, strlen(df_m)); - write(sock, " ", 1); - write(sock, df_Uq, strlen(df_Uq)); - write(sock, " ", 1); - write(sock, df_H, strlen(df_H)); - write(sock, " ", 1); - write(sock, "\r\n", 2); + iov[0].iov_base = df_method; + iov[0].iov_len = strlen(df_method); + iov[2].iov_base = df_url; + iov[2].iov_len = strlen(df_url); + iov[4].iov_base = df_proto; + iov[4].iov_len = strlen(df_proto); + iov[1].iov_base = iov[3].iov_base = space; + iov[1].iov_len = iov[3].iov_len = 1; + iov[5].iov_base = crlf; + iov[5].iov_len = 2; + if (writev(sock, iov, 6) == -1) { + thread_log(0, errno, "writev()"); + goto close; + } - if (strncmp(df_H, "HTTP/1.0", 8)) - reopen = 1; - - write(sock, "Host: ", 6); - if (df_Host) { - thread_log(1, 0, "Host: %s", df_Host); - write(sock, df_Host, strlen(df_Host)); + for (i = 0; i < df_nhdr; ++i) { + thread_log(2, 0, "%d %s", i, df_hdr[i]); + iov[0].iov_base = df_hdr[i]; + iov[0].iov_len = strlen(df_hdr[i]); + iov[1].iov_base = crlf; + iov[1].iov_len = 2; + if (writev(sock, iov, 2) == -1) { + thread_log(0, errno, "writev()"); + goto close; } - write(sock, "\r\n", 2); - if (df_c) { - thread_log(1, 0, "Connection: %s", df_c); - write(sock, "Connection: ", 12); - write(sock, df_c, strlen(df_c)); - write(sock, "\r\n", 2); - if (isequal(df_c, "keep-alive", df_c + strlen(df_c))) - reopen = 0; - } - write(sock, "\r\n", 2); - if (!reopen) - reopen = receive_response(sock); - if (reopen) - close(sock); } + if (write(sock, crlf, 2) == -1) { + thread_log(0, errno, "writev()"); + goto close; + } + if (receive_response(sock) || reopen) { +close: + thread_log(1, 0, "close"); + close(sock); + sock = -1; + } } /* clean up */ - freez(msg->ptr); - freez(msg); - freez(df_H); - freez(df_Host); - freez(df_Uq); - freez(df_m); - freez(df_c); + freez(df_method); + freez(df_url); + freez(df_proto); + freez(df_conn); + while (df_nhdr) { + --df_nhdr; + freez(df_hdr[df_nhdr]); + } bogus = 0; } /* leftovers */ - freez(msg->ptr); - freez(msg); - freez(df_H); - freez(df_Host); - freez(df_Uq); - freez(df_m); - freez(df_c); + freez(df_method); + freez(df_url); + freez(df_proto); + freez(df_conn); + while (df_nhdr) { + --df_nhdr; + freez(df_hdr[df_nhdr]); + } + freez(df_hdr); return (0); } - static int gen_traffic(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr) @@ -623,7 +656,7 @@ if (fd == 0 || !(spec & VSL_S_CLIENT)) return (0); - thread_log(2, 0, "%d %s", fd, VSL_tags[tag]); + thread_log(3, 0, "%d %s", fd, VSL_tags[tag]); thr = thread_get(fd, replay_thread); msg = malloc(sizeof (struct message)); msg->tag = tag; @@ -679,6 +712,8 @@ addr_info = init_connection(address); + signal(SIGPIPE, SIG_IGN); + while (VSL_Dispatch(vd, gen_traffic, NULL) == 0) /* nothing */ ; thread_close(0); Modified: branches/1.1/include/varnishapi.h =================================================================== --- branches/1.1/include/varnishapi.h 2008-03-09 15:26:31 UTC (rev 2578) +++ branches/1.1/include/varnishapi.h 2008-03-09 15:26:55 UTC (rev 2579) @@ -44,8 +44,8 @@ typedef int vsl_handler(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr); #define VSL_S_CLIENT (1 << 0) #define VSL_S_BACKEND (1 << 1) -#define VSL_ARGS "bCcdI:i:r:s:X:x:" -#define VSL_USAGE "[-bCcd] [-i tag] [-I regexp] [-r file] [-s skip] [-X regexp] [-x tag]" +#define VSL_ARGS "bCcdI:i:k:r:s:X:x:" +#define VSL_USAGE "[-bCcd] [-i tag] [-I regexp] [-k keep] [-r file] [-s skip] [-X regexp] [-x tag]" vsl_handler VSL_H_Print; struct VSL_data; struct VSL_data *VSL_New(void); Modified: branches/1.1/lib/libvarnishapi/shmlog.c =================================================================== --- branches/1.1/lib/libvarnishapi/shmlog.c 2008-03-09 15:26:31 UTC (rev 2578) +++ branches/1.1/lib/libvarnishapi/shmlog.c 2008-03-09 15:26:55 UTC (rev 2579) @@ -87,6 +87,7 @@ regex_t *regexcl; unsigned long skip; + unsigned long keep; }; #ifndef MAP_HASSEMAPHORE @@ -294,6 +295,9 @@ if (vd->skip) { --vd->skip; continue; + } else if (vd->keep) { + if (--vd->keep == 0) + return (0); } if (vd->map[p[0]] & M_SELECT) { *pp = p; @@ -495,7 +499,26 @@ } return (1); } +/*--------------------------------------------------------------------*/ +static int +vsl_k_arg(struct VSL_data *vd, const char *opt) +{ + char *end; + + CHECK_OBJ_NOTNULL(vd, VSL_MAGIC); + if (*opt == '\0') { + fprintf(stderr, "number required for -k\n"); + return (-1); + } + vd->keep = strtoul(opt, &end, 10); + if (*end != '\0') { + fprintf(stderr, "invalid number for -k\n"); + return (-1); + } + return (1); +} + /*--------------------------------------------------------------------*/ int @@ -512,6 +535,7 @@ case 'I': case 'X': return (vsl_IX_arg(vd, opt, arg)); case 'C': vd->regflags = REG_ICASE; return (1); case 's': return (vsl_s_arg(vd, opt)); + case 'k': return (vsl_k_arg(vd, opt)); default: return (0); } From ssm at projects.linpro.no Mon Mar 10 06:02:00 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Mon, 10 Mar 2008 07:02:00 +0100 (CET) Subject: r2580 - trunk/varnish-cache/debian Message-ID: <20080310060200.EF33D1EC40C@projects.linpro.no> Author: ssm Date: 2008-03-10 07:02:00 +0100 (Mon, 10 Mar 2008) New Revision: 2580 Modified: trunk/varnish-cache/debian/varnish.default trunk/varnish-cache/debian/varnish.init Log: Debian packaging: Allow adjustment of maximum locked memory size Modified: trunk/varnish-cache/debian/varnish.default =================================================================== --- trunk/varnish-cache/debian/varnish.default 2008-03-09 15:26:55 UTC (rev 2579) +++ trunk/varnish-cache/debian/varnish.default 2008-03-10 06:02:00 UTC (rev 2580) @@ -7,6 +7,11 @@ # Maximum number of open files (for ulimit -n) NFILES=131072 +# Maximum locked memory size (for ulimit -l) +# Used for locking the shared memory log in memory. If you increase log size, +# you need to increase this number as well +MEMLOCK=82000 + # Default varnish instance name is the local nodename. Can be overridden with # the -n switch, to have more instances on a single server. INSTANCE=$(uname -n) Modified: trunk/varnish-cache/debian/varnish.init =================================================================== --- trunk/varnish-cache/debian/varnish.init 2008-03-09 15:26:55 UTC (rev 2579) +++ trunk/varnish-cache/debian/varnish.init 2008-03-10 06:02:00 UTC (rev 2580) @@ -34,6 +34,9 @@ # Open files (usually 1024, which is way too small for varnish) ulimit -n ${NFILES:-131072} +# Maxiumum locked memory size for shared memory log +ulimit -l ${MEMLOCK:-82000} + # If $DAEMON_OPTS is not set at all in /etc/default/varnish, use minimal useful # defaults (Backend at localhost:8080, a common place to put a locally # installed application server.) From ssm at projects.linpro.no Mon Mar 10 06:47:13 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Mon, 10 Mar 2008 07:47:13 +0100 (CET) Subject: r2581 - in branches/1.2: . debian Message-ID: <20080310064713.9C7691EC436@projects.linpro.no> Author: ssm Date: 2008-03-10 07:47:13 +0100 (Mon, 10 Mar 2008) New Revision: 2581 Modified: branches/1.2/ branches/1.2/debian/varnish.postinst Log: Merged revisions 2291 via svnmerge from svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache ........ r2291 | ssm | 2007-12-11 08:02:24 +0100 (Tue, 11 Dec 2007) | 4 lines Debian packaging: Remove extra debhelper section in main postinst file, this was included by the debhelper tag as well, which resulted in a double startup entry, and an error on package installation. ........ Property changes on: branches/1.2 ___________________________________________________________________ Name: svnmerge-integrated - /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317,2319,2321-2327,2337,2358,2362-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2522-2524,2545,2563-2565,2569,2572,2575-2577 + /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2291,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317,2319,2321-2327,2337,2358,2362-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2522-2524,2545,2563-2565,2569,2572,2575-2577 Modified: branches/1.2/debian/varnish.postinst =================================================================== --- branches/1.2/debian/varnish.postinst 2008-03-10 06:02:00 UTC (rev 2580) +++ branches/1.2/debian/varnish.postinst 2008-03-10 06:47:13 UTC (rev 2581) @@ -13,13 +13,3 @@ varnish_create_storagedir #DEBHELPER# -# Automatically added by dh_installinit -if [ -x "/etc/init.d/varnish" ]; then - update-rc.d varnish defaults >/dev/null - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d varnish start || exit $? - else - /etc/init.d/varnish start || exit $? - fi -fi -# End automatically added section From ssm at projects.linpro.no Mon Mar 10 07:13:37 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Mon, 10 Mar 2008 08:13:37 +0100 (CET) Subject: r2582 - trunk/varnish-cache/debian Message-ID: <20080310071337.2A27F1EC434@projects.linpro.no> Author: ssm Date: 2008-03-10 08:13:36 +0100 (Mon, 10 Mar 2008) New Revision: 2582 Removed: trunk/varnish-cache/debian/TODO Log: Debian packaging: removing obsolete TODO file Deleted: trunk/varnish-cache/debian/TODO =================================================================== --- trunk/varnish-cache/debian/TODO 2008-03-10 06:47:13 UTC (rev 2581) +++ trunk/varnish-cache/debian/TODO 2008-03-10 07:13:36 UTC (rev 2582) @@ -1,3 +0,0 @@ -- Write helper script to create storage_file from defaults -- possibly setup default logging -- get the 4. (advertising) clause BSD license removed from the source, if possible From ssm at projects.linpro.no Mon Mar 10 07:15:56 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Mon, 10 Mar 2008 08:15:56 +0100 (CET) Subject: r2583 - trunk/varnish-cache/debian Message-ID: <20080310071556.8C0011EC418@projects.linpro.no> Author: ssm Date: 2008-03-10 08:15:56 +0100 (Mon, 10 Mar 2008) New Revision: 2583 Modified: trunk/varnish-cache/debian/changelog Log: Debian packaging: Add changelog entry for 1.2-0 Modified: trunk/varnish-cache/debian/changelog =================================================================== --- trunk/varnish-cache/debian/changelog 2008-03-10 07:13:36 UTC (rev 2582) +++ trunk/varnish-cache/debian/changelog 2008-03-10 07:15:56 UTC (rev 2583) @@ -1,3 +1,9 @@ +varnish (1.2-0) unstable; urgency=low + + * New upstream release + + -- Stig Sandbeck Mathisen Mon, 10 Mar 2008 06:58:19 +0100 + varnish (1.1.2-1) unstable; urgency=low * Add debian revision From ssm at projects.linpro.no Mon Mar 10 07:28:13 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Mon, 10 Mar 2008 08:28:13 +0100 (CET) Subject: r2584 - in branches/1.2: . debian Message-ID: <20080310072813.1F82F1EC434@projects.linpro.no> Author: ssm Date: 2008-03-10 08:28:12 +0100 (Mon, 10 Mar 2008) New Revision: 2584 Removed: branches/1.2/debian/TODO branches/1.2/debian/lintian-override Modified: branches/1.2/ branches/1.2/debian/changelog branches/1.2/debian/control branches/1.2/debian/rules branches/1.2/debian/varnish.default branches/1.2/debian/varnish.varnishlog.init Log: Merged revisions 2288-2290,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317-2319,2321,2323,2325-2327,2329-2330,2357-2358,2361-2364,2366,2374,2376-2378,2380-2381,2384-2386,2426,2432-2434,2495-2499,2503-2505,2520-2524,2545,2563-2564,2566-2568,2570-2571,2573-2574,2578-2579,2581-2583 via svnmerge from svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache ........ r2288 | ssm | 2007-12-11 06:46:43 +0100 (Tue, 11 Dec 2007) | 3 lines In the debian /etc/default/varnish, remove unused configuration variable, and an erroneous use of -n from the configuration examples. ........ r2289 | ssm | 2007-12-11 07:10:47 +0100 (Tue, 11 Dec 2007) | 1 line Debian packaging: do not ignore all errors from make distclean ........ r2290 | ssm | 2007-12-11 07:14:49 +0100 (Tue, 11 Dec 2007) | 7 lines Changes in the Debian packaging * Use native version for the debian package * Add headers to indicate location of varnish source * Add "xsltproc" to build dependencies ........ r2318 | ssm | 2007-12-20 12:03:58 +0100 (Thu, 20 Dec 2007) | 2 lines Add another uploader for the debian package ........ r2329 | ssm | 2008-01-02 07:25:36 +0100 (Wed, 02 Jan 2008) | 2 lines Debian packaging: Tag library and development package with correct section. ........ r2330 | ssm | 2008-01-02 07:26:23 +0100 (Wed, 02 Jan 2008) | 2 lines Debian packaging: Remove lintian overrides ........ r2357 | ssm | 2008-01-21 20:04:41 +0100 (Mon, 21 Jan 2008) | 1 line Debian packaging: Add a debian revision to the version number ........ r2361 | ssm | 2008-01-22 09:36:07 +0100 (Tue, 22 Jan 2008) | 1 line Debian packaging: update changelog ........ r2520 | ssm | 2008-02-20 13:02:07 +0100 (Wed, 20 Feb 2008) | 1 line Debian packaging: Disable running of varnishlog by default ........ r2521 | ssm | 2008-02-20 14:39:59 +0100 (Wed, 20 Feb 2008) | 1 line Typo patrol ........ r2582 | ssm | 2008-03-10 08:13:36 +0100 (Mon, 10 Mar 2008) | 1 line Debian packaging: removing obsolete TODO file ........ r2583 | ssm | 2008-03-10 08:15:56 +0100 (Mon, 10 Mar 2008) | 1 line Debian packaging: Add changelog entry for 1.2-0 ........ Property changes on: branches/1.2 ___________________________________________________________________ Name: svnmerge-integrated - /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2291,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317,2319,2321-2327,2337,2358,2362-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2522-2524,2545,2563-2565,2569,2572,2575-2577 + /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2288-2291,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317-2319,2321-2327,2329-2330,2337,2357-2358,2361-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2520-2524,2545,2563-2579,2581-2583 Deleted: branches/1.2/debian/TODO =================================================================== --- branches/1.2/debian/TODO 2008-03-10 07:15:56 UTC (rev 2583) +++ branches/1.2/debian/TODO 2008-03-10 07:28:12 UTC (rev 2584) @@ -1,3 +0,0 @@ -- Write helper script to create storage_file from defaults -- possibly setup default logging -- get the 4. (advertising) clause BSD license removed from the source, if possible Modified: branches/1.2/debian/changelog =================================================================== --- branches/1.2/debian/changelog 2008-03-10 07:15:56 UTC (rev 2583) +++ branches/1.2/debian/changelog 2008-03-10 07:28:12 UTC (rev 2584) @@ -1,5 +1,19 @@ +varnish (1.2-0) unstable; urgency=low + + * New upstream release + + -- Stig Sandbeck Mathisen Mon, 10 Mar 2008 06:58:19 +0100 + varnish (1.1.2-1) unstable; urgency=low + * Add debian revision + * Check if varnishlog is running before attempting reload from + logrotate postscript (Closes: #462029) + + -- Stig Sandbeck Mathisen Tue, 22 Jan 2008 09:35:05 +0100 + +varnish (1.1.2) unstable; urgency=low + * New upstream release * Renamed library and development packages to reflect sonames Modified: branches/1.2/debian/control =================================================================== --- branches/1.2/debian/control 2008-03-10 07:15:56 UTC (rev 2583) +++ branches/1.2/debian/control 2008-03-10 07:28:12 UTC (rev 2584) @@ -2,9 +2,11 @@ Section: web Priority: optional Maintainer: Stig Sandbeck Mathisen -Uploaders: Lars Bahner -Build-Depends: debhelper (>= 5), autotools-dev, automake1.9, libtool, autoconf, libncurses-dev -Standards-Version: 3.7.2 +Uploaders: Lars Bahner , Fabio Tranchitella +Build-Depends: debhelper (>= 5), autotools-dev, automake1.9, libtool, autoconf, libncurses-dev, xsltproc +XS-Vcs-Browser: http://varnish.projects.linpro.no/browser/trunk/varnish-cache +XS-Vcs-Svn: http://varnish.projects.linpro.no/svn/trunk/varnish-cache +Standards-Version: 3.7.3 Package: varnish Architecture: any @@ -22,6 +24,7 @@ operating systems. Package: libvarnish0 +Section: libs Replaces: libvarnish Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} @@ -29,6 +32,7 @@ Shared libraries for the Varnish HTTP accelerator. Package: libvarnish0-dev +Section: libdevel Replaces: libvarnish-dev Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, libvarnish0 Deleted: branches/1.2/debian/lintian-override =================================================================== --- branches/1.2/debian/lintian-override 2008-03-10 07:15:56 UTC (rev 2583) +++ branches/1.2/debian/lintian-override 2008-03-10 07:28:12 UTC (rev 2584) @@ -1,3 +0,0 @@ -varnish: duplicate-updaterc.d-calls-in-postinst varnish -varnish: duplicate-updaterc.d-calls-in-postinst varnishlog - Modified: branches/1.2/debian/rules =================================================================== --- branches/1.2/debian/rules 2008-03-10 07:15:56 UTC (rev 2583) +++ branches/1.2/debian/rules 2008-03-10 07:28:12 UTC (rev 2584) @@ -49,7 +49,7 @@ dh_testroot rm -f build-stamp - -$(MAKE) distclean + [ ! -f Makefile ] || $(MAKE) distclean ifneq "$(wildcard /usr/share/misc/config.sub)" "" cp -f /usr/share/misc/config.sub config.sub endif @@ -70,7 +70,6 @@ dh_install --sourcedir=$(CURDIR)/debian/tmp install -m 644 $(CURDIR)/etc/default.vcl $(CURDIR)/debian/varnish/etc/varnish/ - install -m 644 $(CURDIR)/debian/lintian-override $(CURDIR)/debian/varnish/usr/share/lintian/overrides/varnish install -m 644 $(CURDIR)/debian/varnish.logrotate $(CURDIR)/debian/varnish/etc/logrotate.d/varnish Modified: branches/1.2/debian/varnish.default =================================================================== --- branches/1.2/debian/varnish.default 2008-03-10 07:15:56 UTC (rev 2583) +++ branches/1.2/debian/varnish.default 2008-03-10 07:28:12 UTC (rev 2584) @@ -11,6 +11,10 @@ # the -n switch, to have more instances on a single server. INSTANCE=$(uname -n) +# Uncomment this to enable varnishlog. Please make sure you have +# enough disk space for significant amounts of log data. +# VARNISHLOG_ENABLE=1 + # This file contains 4 alternatives, please use only one. ## Alternative 1, Minimal configuration, no VCL @@ -34,7 +38,6 @@ # DAEMON_OPTS="-a :6081 \ # -T localhost:6082 \ # -f /etc/varnish/default.vcl \ -# -n /var/lib/varnish \ # -s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,1G" @@ -64,9 +67,6 @@ # # Idle timeout for worker threads # VARNISH_THREAD_TIMEOUT=120 # -# # Home dir for this varnish instance -# VARNISH_HOMEDIR=/var/lib/varnish -# # # Cache file location # VARNISH_STORAGE_FILE=/var/lib/varnish/$INSTANCE/varnish_storage.bin # Modified: branches/1.2/debian/varnish.varnishlog.init =================================================================== --- branches/1.2/debian/varnish.varnishlog.init 2008-03-10 07:15:56 UTC (rev 2583) +++ branches/1.2/debian/varnish.varnishlog.init 2008-03-10 07:28:12 UTC (rev 2584) @@ -22,6 +22,16 @@ PIDFILE=/var/run/$NAME.pid LOGFILE=/var/log/varnish/varnish.log +# Include varnish defaults if available +if [ -f /etc/default/varnish ] ; then + . /etc/default/varnish +fi + +# If unset or not 1, exit +if [ -z "${VARNISHLOG_ENABLED}" -o "${VARNISHLOG_ENABLED}" -ne "1" ]; then + exit 0; +fi + test -x $DAEMON || exit 0 DAEMON_OPTS="-a -w ${LOGFILE} -D -P $PIDFILE" From ssm at projects.linpro.no Mon Mar 10 07:30:29 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Mon, 10 Mar 2008 08:30:29 +0100 (CET) Subject: r2585 - in branches/1.2: . debian Message-ID: <20080310073029.76FC81EC418@projects.linpro.no> Author: ssm Date: 2008-03-10 08:30:29 +0100 (Mon, 10 Mar 2008) New Revision: 2585 Modified: branches/1.2/ branches/1.2/debian/varnish.logrotate Log: Merged revisions 2359 via svnmerge from svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache ........ r2359 | ssm | 2008-01-22 09:28:18 +0100 (Tue, 22 Jan 2008) | 3 lines Debian packaging: Only reload varnishlog if it is running. (Debian bug #462029) ........ Property changes on: branches/1.2 ___________________________________________________________________ Name: svnmerge-integrated - /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2288-2291,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317-2319,2321-2327,2329-2330,2337,2357-2358,2361-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2520-2524,2545,2563-2579,2581-2583 + /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2288-2291,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317-2319,2321-2327,2329-2330,2337,2357-2359,2361-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2520-2524,2545,2563-2579,2581-2583 Modified: branches/1.2/debian/varnish.logrotate =================================================================== --- branches/1.2/debian/varnish.logrotate 2008-03-10 07:28:12 UTC (rev 2584) +++ branches/1.2/debian/varnish.logrotate 2008-03-10 07:30:29 UTC (rev 2585) @@ -4,6 +4,8 @@ compress delaycompress postrotate - /usr/sbin/invoke-rc.d varnishlog reload > /dev/null + if /usr/bin/pgrep -P 1 varnishlog >/dev/null; then + /usr/sbin/invoke-rc.d varnishlog reload > /dev/null + fi endscript } From ssm at projects.linpro.no Mon Mar 10 07:46:38 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Mon, 10 Mar 2008 08:46:38 +0100 (CET) Subject: r2586 - trunk/varnish-cache/debian Message-ID: <20080310074638.1D24B1EC435@projects.linpro.no> Author: ssm Date: 2008-03-10 08:46:37 +0100 (Mon, 10 Mar 2008) New Revision: 2586 Modified: trunk/varnish-cache/debian/varnish.default trunk/varnish-cache/debian/varnish.varnishlog.init Log: Debian packaging: Fix syntax error in varnishlog init script, and set correct variable in defaults file. Add clarifying comment for variable Modified: trunk/varnish-cache/debian/varnish.default =================================================================== --- trunk/varnish-cache/debian/varnish.default 2008-03-10 07:30:29 UTC (rev 2585) +++ trunk/varnish-cache/debian/varnish.default 2008-03-10 07:46:37 UTC (rev 2586) @@ -17,8 +17,9 @@ INSTANCE=$(uname -n) # Uncomment this to enable varnishlog. Please make sure you have -# enough disk space for significant amounts of log data. -# VARNISHLOG_ENABLE=1 +# enough disk space for significant amounts of log data. To disable +# varnishlog, set the variable to "0", "no", or leave it unset. +# VARNISHLOG_ENABLED=1 # This file contains 4 alternatives, please use only one. Modified: trunk/varnish-cache/debian/varnish.varnishlog.init =================================================================== --- trunk/varnish-cache/debian/varnish.varnishlog.init 2008-03-10 07:30:29 UTC (rev 2585) +++ trunk/varnish-cache/debian/varnish.varnishlog.init 2008-03-10 07:46:37 UTC (rev 2586) @@ -27,8 +27,9 @@ . /etc/default/varnish fi -# If unset or not 1, exit -if [ -z "${VARNISHLOG_ENABLED}" -o "${VARNISHLOG_ENABLED}" -ne "1" ]; then +# If unset, or set to "0" or "no", exit +if [ -z "${VARNISHLOG_ENABLED}" -o "${VARNISHLOG_ENABLED}" == "0" \ + -o "${VARNISHLOG_ENABLED}" == "no" ]; then exit 0; fi From ssm at projects.linpro.no Mon Mar 10 07:51:56 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Mon, 10 Mar 2008 08:51:56 +0100 (CET) Subject: r2587 - in branches/1.2: . debian Message-ID: <20080310075156.E9D401EC434@projects.linpro.no> Author: ssm Date: 2008-03-10 08:51:56 +0100 (Mon, 10 Mar 2008) New Revision: 2587 Modified: branches/1.2/ branches/1.2/debian/varnish.default branches/1.2/debian/varnish.varnishlog.init Log: Merged revisions 2586 via svnmerge from svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache ........ r2586 | ssm | 2008-03-10 08:46:37 +0100 (Mon, 10 Mar 2008) | 1 line Debian packaging: Fix syntax error in varnishlog init script, and set correct variable in defaults file. Add clarifying comment for variable ........ Property changes on: branches/1.2 ___________________________________________________________________ Name: svnmerge-integrated - /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2288-2291,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317-2319,2321-2327,2329-2330,2337,2357-2359,2361-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2520-2524,2545,2563-2579,2581-2583 + /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2288-2291,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317-2319,2321-2327,2329-2330,2337,2357-2359,2361-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2520-2524,2545,2563-2579,2581-2583,2586 Modified: branches/1.2/debian/varnish.default =================================================================== --- branches/1.2/debian/varnish.default 2008-03-10 07:46:37 UTC (rev 2586) +++ branches/1.2/debian/varnish.default 2008-03-10 07:51:56 UTC (rev 2587) @@ -12,8 +12,9 @@ INSTANCE=$(uname -n) # Uncomment this to enable varnishlog. Please make sure you have -# enough disk space for significant amounts of log data. -# VARNISHLOG_ENABLE=1 +# enough disk space for significant amounts of log data. To disable +# varnishlog, set the variable to "0", "no", or leave it unset. +# VARNISHLOG_ENABLED=1 # This file contains 4 alternatives, please use only one. Modified: branches/1.2/debian/varnish.varnishlog.init =================================================================== --- branches/1.2/debian/varnish.varnishlog.init 2008-03-10 07:46:37 UTC (rev 2586) +++ branches/1.2/debian/varnish.varnishlog.init 2008-03-10 07:51:56 UTC (rev 2587) @@ -27,8 +27,9 @@ . /etc/default/varnish fi -# If unset or not 1, exit -if [ -z "${VARNISHLOG_ENABLED}" -o "${VARNISHLOG_ENABLED}" -ne "1" ]; then +# If unset, or set to "0" or "no", exit +if [ -z "${VARNISHLOG_ENABLED}" -o "${VARNISHLOG_ENABLED}" == "0" \ + -o "${VARNISHLOG_ENABLED}" == "no" ]; then exit 0; fi From ssm at projects.linpro.no Mon Mar 10 08:17:24 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Mon, 10 Mar 2008 09:17:24 +0100 (CET) Subject: r2588 - trunk/varnish-cache/debian Message-ID: <20080310081724.58FF71EC435@projects.linpro.no> Author: ssm Date: 2008-03-10 09:17:23 +0100 (Mon, 10 Mar 2008) New Revision: 2588 Added: trunk/varnish-cache/debian/varnish.docs Removed: trunk/varnish-cache/debian/docs Log: Debian packaging: Move control file "docs" to "varnish.docs" for consistency, add HTML changelogs from the doc/ directory to the packaging Deleted: trunk/varnish-cache/debian/docs =================================================================== --- trunk/varnish-cache/debian/docs 2008-03-10 07:51:56 UTC (rev 2587) +++ trunk/varnish-cache/debian/docs 2008-03-10 08:17:23 UTC (rev 2588) @@ -1 +0,0 @@ -README Copied: trunk/varnish-cache/debian/varnish.docs (from rev 2579, trunk/varnish-cache/debian/docs) =================================================================== --- trunk/varnish-cache/debian/varnish.docs (rev 0) +++ trunk/varnish-cache/debian/varnish.docs 2008-03-10 08:17:23 UTC (rev 2588) @@ -0,0 +1,3 @@ +README +INSTALL +doc/*.html From ssm at projects.linpro.no Mon Mar 10 08:22:31 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Mon, 10 Mar 2008 09:22:31 +0100 (CET) Subject: r2589 - in branches/1.2: . debian Message-ID: <20080310082231.CFFBE1EC418@projects.linpro.no> Author: ssm Date: 2008-03-10 09:22:31 +0100 (Mon, 10 Mar 2008) New Revision: 2589 Added: branches/1.2/debian/varnish.docs Removed: branches/1.2/debian/docs Modified: branches/1.2/ Log: Merged revisions 2588 via svnmerge from svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache ........ r2588 | ssm | 2008-03-10 09:17:23 +0100 (Mon, 10 Mar 2008) | 1 line Debian packaging: Move control file "docs" to "varnish.docs" for consistency, add HTML changelogs from the doc/ directory to the packaging ........ Property changes on: branches/1.2 ___________________________________________________________________ Name: svnmerge-integrated - /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2288-2291,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317-2319,2321-2327,2329-2330,2337,2357-2359,2361-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2520-2524,2545,2563-2579,2581-2583,2586 + /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2288-2291,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317-2319,2321-2327,2329-2330,2337,2357-2359,2361-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2520-2524,2545,2563-2579,2581-2583,2586,2588 Deleted: branches/1.2/debian/docs =================================================================== --- branches/1.2/debian/docs 2008-03-10 08:17:23 UTC (rev 2588) +++ branches/1.2/debian/docs 2008-03-10 08:22:31 UTC (rev 2589) @@ -1 +0,0 @@ -README Copied: branches/1.2/debian/varnish.docs (from rev 2588, trunk/varnish-cache/debian/varnish.docs) =================================================================== --- branches/1.2/debian/varnish.docs (rev 0) +++ branches/1.2/debian/varnish.docs 2008-03-10 08:22:31 UTC (rev 2589) @@ -0,0 +1,3 @@ +README +INSTALL +doc/*.html From phk at projects.linpro.no Mon Mar 10 21:21:15 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 10 Mar 2008 22:21:15 +0100 (CET) Subject: r2590 - trunk/varnish-cache/bin/varnishd Message-ID: <20080310212115.B96AC1EC434@projects.linpro.no> Author: phk Date: 2008-03-10 22:21:15 +0100 (Mon, 10 Mar 2008) New Revision: 2590 Modified: trunk/varnish-cache/bin/varnishd/shmlog.c Log: This is slightly experimental: Reduce SHM mutex contention further, by only holding lock over reservation of space, and do the copying from workthread buffer to shm buffer efter we let go of the mutex. Modified: trunk/varnish-cache/bin/varnishd/shmlog.c =================================================================== --- trunk/varnish-cache/bin/varnishd/shmlog.c 2008-03-10 08:22:31 UTC (rev 2589) +++ trunk/varnish-cache/bin/varnishd/shmlog.c 2008-03-10 21:21:15 UTC (rev 2590) @@ -185,13 +185,13 @@ if (loghead->ptr + l + 1 >= loghead->size) vsl_wrap(); p = logstart + loghead->ptr; - memcpy(p + 1, w->wlb + 1, l - 1); p[l] = SLT_ENDMARKER; loghead->ptr += l; assert(loghead->ptr < loghead->size); + UNLOCKSHM(&vsl_mtx); + memcpy(p + 1, w->wlb + 1, l - 1); /* XXX: memory barrier here */ p[0] = w->wlb[0]; - UNLOCKSHM(&vsl_mtx); w->wlp = w->wlb; w->wlr = 0; } From des at projects.linpro.no Tue Mar 11 09:48:28 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 11 Mar 2008 10:48:28 +0100 (CET) Subject: r2591 - trunk/varnish-cache/lib/libvarnishapi Message-ID: <20080311094828.1627D1EC40C@projects.linpro.no> Author: des Date: 2008-03-11 10:48:27 +0100 (Tue, 11 Mar 2008) New Revision: 2591 Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c Log: VSL_H_Print() prints a 'b' in the third column for backend-related log entries, a 'c' for client-related log entries, and a ' ' for everything else (CLI Ping for instance). This makes it hard to process logs with awk or similar tools, since the number of columns varies. Therefore, change the character used for non-backend-or-client log entries to '-'. Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2008-03-10 21:21:15 UTC (rev 2590) +++ trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2008-03-11 09:48:27 UTC (rev 2591) @@ -363,11 +363,15 @@ VSL_H_Print(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr) { FILE *fo = priv; + int type; assert(fo != NULL); + + type = (spec & VSL_S_CLIENT) ? 'c' : + (spec & VSL_S_BACKEND) ? 'b' : '-'; + if (tag == SLT_Debug) { - fprintf(fo, "%5d %-12s %c \"", fd, VSL_tags[tag], - ((spec & VSL_S_CLIENT) ? 'c' : (spec & VSL_S_BACKEND) ? 'b' : ' ')); + fprintf(fo, "%5d %-12s %c \"", fd, VSL_tags[tag], type); while (len-- > 0) { if (*ptr >= ' ' && *ptr <= '~') fprintf(fo, "%c", *ptr); @@ -378,10 +382,7 @@ fprintf(fo, "\"\n"); return (0); } - fprintf(fo, "%5d %-12s %c %.*s\n", - fd, VSL_tags[tag], - ((spec & VSL_S_CLIENT) ? 'c' : (spec & VSL_S_BACKEND) ? 'b' : ' '), - len, ptr); + fprintf(fo, "%5d %-12s %c %.*s\n", fd, VSL_tags[tag], type, len, ptr); return (0); } From des at projects.linpro.no Tue Mar 11 11:10:19 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 11 Mar 2008 12:10:19 +0100 (CET) Subject: r2592 - trunk/varnish-cache/bin/varnishd Message-ID: <20080311111019.95F651EC6C3@projects.linpro.no> Author: des Date: 2008-03-11 12:10:19 +0100 (Tue, 11 Mar 2008) New Revision: 2592 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c Log: Fix a couple of glaring errors in vca_pollspace(). Noticed by: Jyri J. Virkki Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c 2008-03-11 09:48:27 UTC (rev 2591) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c 2008-03-11 11:10:19 UTC (rev 2592) @@ -56,23 +56,21 @@ static void vca_pollspace(unsigned fd) { - struct pollfd *p; - unsigned u, v; + struct pollfd *newpollfd; + unsigned newnpoll; if (fd < npoll) return; - if (npoll == 0) - npoll = 16; - for (u = npoll; fd >= u; ) - u += u; - VSL(SLT_Debug, 0, "Acceptor Pollspace %u", u); - p = realloc(pollfd, u * sizeof *p); - XXXAN(p); /* close offending fd */ - memset(p + npoll, 0, (u - npoll) * sizeof *p); - for (v = npoll ; v <= u; v++) - p->fd = -1; - pollfd = p; - npoll = u; + newnpoll = npoll; + while (fd >= newnpoll) + newnpoll = newnpoll * 2 + 1; + VSL(SLT_Debug, 0, "Acceptor poll space increased to %u", newnpoll); + newpollfd = realloc(pollfd, newnpoll * sizeof *pollfd); + XXXAN(newpollfd); /* close offending fd */ + pollfd = newpollfd; + memset(pollfd + npoll, 0, (newnpoll - npoll) * sizeof *pollfd); + while (npoll < newnpoll) + pollfd[npoll++].fd = -1; } /*--------------------------------------------------------------------*/ From des at projects.linpro.no Tue Mar 11 11:25:28 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 11 Mar 2008 12:25:28 +0100 (CET) Subject: r2593 - trunk/varnish-cache/bin/varnishd Message-ID: <20080311112528.95EEF1EC50B@projects.linpro.no> Author: des Date: 2008-03-11 12:25:28 +0100 (Tue, 11 Mar 2008) New Revision: 2593 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c Log: Slightly more elegant version of the previous commit, which also fixed a tiny braino. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c 2008-03-11 11:10:19 UTC (rev 2592) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c 2008-03-11 11:25:28 UTC (rev 2593) @@ -56,8 +56,8 @@ static void vca_pollspace(unsigned fd) { - struct pollfd *newpollfd; - unsigned newnpoll; + struct pollfd *newpollfd = pollfd; + unsigned newnpoll = npoll; if (fd < npoll) return; @@ -65,10 +65,10 @@ while (fd >= newnpoll) newnpoll = newnpoll * 2 + 1; VSL(SLT_Debug, 0, "Acceptor poll space increased to %u", newnpoll); - newpollfd = realloc(pollfd, newnpoll * sizeof *pollfd); + newpollfd = realloc(newpollfd, newnpoll * sizeof *newpollfd); XXXAN(newpollfd); /* close offending fd */ + memset(newpollfd + npoll, 0, (newnpoll - npoll) * sizeof *newpollfd); pollfd = newpollfd; - memset(pollfd + npoll, 0, (newnpoll - npoll) * sizeof *pollfd); while (npoll < newnpoll) pollfd[npoll++].fd = -1; } From phk at projects.linpro.no Wed Mar 12 10:21:51 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 12 Mar 2008 11:21:51 +0100 (CET) Subject: r2594 - trunk/varnish-cache/lib/libvarnish Message-ID: <20080312102151.B685C1EC40C@projects.linpro.no> Author: phk Date: 2008-03-12 11:21:49 +0100 (Wed, 12 Mar 2008) New Revision: 2594 Modified: trunk/varnish-cache/lib/libvarnish/cli.c Log: Change the default cli help function to ignore options starting with '-'. Remove header line. If argument is not found, return CLIS_UNKNOWN. Modified: trunk/varnish-cache/lib/libvarnish/cli.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/cli.c 2008-03-11 11:25:28 UTC (rev 2593) +++ trunk/varnish-cache/lib/libvarnish/cli.c 2008-03-12 10:21:49 UTC (rev 2594) @@ -52,8 +52,7 @@ { struct cli_proto *cp; - if (av[2] == NULL) { - cli_out(cli, "Available commands:\n"); + if (av[2] == NULL || *av[2] == '-') { for (cp = priv; cp->request != NULL; cp++) cli_out(cli, "%s\n", cp->syntax); return; @@ -64,7 +63,8 @@ return; } } - cli_param(cli); + cli_out(cli, "Unknown request.\nType 'help' for more info.\n"); + cli_result(cli, CLIS_UNKNOWN); } void @@ -97,7 +97,7 @@ break; if (cp->request == NULL) { cli_out(cli, - "Unknown request, type 'help' for more info.\n"); + "Unknown request.\nType 'help' for more info.\n"); cli_result(cli, CLIS_UNKNOWN); break; } From phk at projects.linpro.no Wed Mar 12 10:25:51 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 12 Mar 2008 11:25:51 +0100 (CET) Subject: r2595 - in trunk/varnish-cache: bin/varnishd include Message-ID: <20080312102551.A832E1EC4A8@projects.linpro.no> Author: phk Date: 2008-03-12 11:25:51 +0100 (Wed, 12 Mar 2008) New Revision: 2595 Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/bin/varnishd/varnishd.c trunk/varnish-cache/include/cli_common.h Log: Rework the manager/cacher cli relationship, so that the manager does not have to grope around in the cacher's data structures. Whenever the manager gets a CLI command it does not understand, it will pass it to the cacher process, if it is running. This complicated "help" a little bit, because we want to show the combined commands of the manager and cacher. Since we're dealing with help anyway, hide undocumented debug commands from it. Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-03-12 10:21:49 UTC (rev 2594) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-03-12 10:25:51 UTC (rev 2595) @@ -85,29 +85,69 @@ return; } - /*--------------------------------------------------------------------*/ -struct cli_proto CLI_cmds[] = { +static void ccf_help(struct cli *cli, const char * const *av, void *priv); + +/*-------------------------------------------------------------------- + * The CLI commandlist is split in three: + * Commands we get from/share with the manager + * Cache process commands + * Undocumented commands + */ + +static struct cli_proto master_cmds[] = { { CLI_PING, cli_func_ping }, { CLI_SERVER_START, cli_func_start }, -#if 0 - { CLI_URL_QUERY, cli_func_url_query }, -#endif - { CLI_URL_PURGE, cli_func_url_purge }, - { CLI_HASH_PURGE, cli_func_hash_purge }, { CLI_VCL_LOAD, cli_func_config_load }, { CLI_VCL_LIST, cli_func_config_list }, { CLI_VCL_DISCARD, cli_func_config_discard }, { CLI_VCL_USE, cli_func_config_use }, + { NULL } +}; - /* Undocumented functions for debugging */ +static struct cli_proto cacher_cmds[] = { + { CLI_HELP, ccf_help, NULL }, + { CLI_URL_PURGE, cli_func_url_purge }, + { CLI_HASH_PURGE, cli_func_hash_purge }, +#if 0 + { CLI_URL_QUERY, cli_func_url_query }, +#endif + { NULL } +}; + +static struct cli_proto undoc_cmds[] = { { "debug.sizeof", "debug.sizeof", "\tDump sizeof various data structures\n", 0, 0, cli_debug_sizeof }, { NULL } }; + +/*--------------------------------------------------------------------*/ + +static void +ccf_help(struct cli *cli, const char * const *av, void *priv) +{ + + (void)priv; + /* "+1" to skip "help" entry, manager already did that. */ + cli_func_help(cli, av, cacher_cmds + 1); + + if (av[2] != NULL && !strcmp(av[2], "-d")) { + /* Also list undocumented commands */ + cli_out(cli, "\nDebugging commands:\n"); + cli_func_help(cli, av, undoc_cmds); + } else if (cli->result == CLIS_UNKNOWN) { + /* Otherwise, try the undocumented list */ + vsb_clear(cli->sb); + cli->result = CLIS_OK; + cli_func_help(cli, av, undoc_cmds); + } +} + +/*--------------------------------------------------------------------*/ + static int cli_vlu(void *priv, const char *p) { @@ -117,7 +157,17 @@ cli = priv; VSL(SLT_CLI, 0, "Rd %s", p); vsb_clear(cli->sb); - cli_dispatch(cli, CLI_cmds, p); + cli_dispatch(cli, master_cmds, p); + if (cli->result == CLIS_UNKNOWN) { + vsb_clear(cli->sb); + cli->result = CLIS_OK; + cli_dispatch(cli, cacher_cmds, p); + } + if (cli->result == CLIS_UNKNOWN) { + vsb_clear(cli->sb); + cli->result = CLIS_OK; + cli_dispatch(cli, undoc_cmds, p); + } vsb_finish(cli->sb); AZ(vsb_overflowed(cli->sb)); i = cli_writeres(heritage.fds[1], cli); Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2008-03-12 10:21:49 UTC (rev 2594) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2008-03-12 10:25:51 UTC (rev 2595) @@ -78,73 +78,30 @@ #undef MAC_STAT } - -/*-------------------------------------------------------------------- - * Passthru of cli commands. It is more or less just undoing what - * the cli parser did, but such is life... - */ - static void -mcf_passthru(struct cli *cli, const char * const *av, void *priv) +mcf_help(struct cli *cli, const char * const *av, void *priv) { - struct vsb *sb; - const char *p; - char *q; unsigned u; - int i; + char *p; - (void)priv; - - /* Request */ - if (cli_o <= 0) { - cli_result(cli, CLIS_CANT); - cli_out(cli, "Cache process not running"); - return; + cli_func_help(cli, av, priv); + if (cli_o >= 0 && (av[2] == NULL || *av[2] == '-')) { + p = NULL; + if (!mgt_cli_askchild(&u, &p, + "help %s\n", av[2] != NULL ? av[2] : "")) { + cli_out(cli, "%s", p); + cli_result(cli, u); + } + free(p); } - sb = vsb_new(NULL, NULL, 64, VSB_AUTOEXTEND); - XXXAN(sb); - for (u = 1; av[u] != NULL; u++) { - if (u > 1) - vsb_putc(sb, ' '); - vsb_putc(sb, '"'); - for (p = av[u]; *p; p++) { - switch (*p) { - case '\\': - vsb_cat(sb, "\\\\"); - break; - case '\n': - vsb_cat(sb, "\\n"); - break; - case '"': - vsb_cat(sb, "\\\""); - break; - default: - vsb_putc(sb, *p); - } - } - vsb_putc(sb, '"'); - } - vsb_putc(sb, '\n'); - xxxassert(!vsb_overflowed(sb)); - vsb_finish(sb); - AZ(vsb_overflowed(sb)); - i = write(cli_o, vsb_data(sb), vsb_len(sb)); - xxxassert(i == vsb_len(sb)); - vsb_delete(sb); - - i = cli_readres(cli_i, &u, &q, params->cli_timeout); - cli_result(cli, u); - cli_out(cli, "%s", q); - free(q); - } /*--------------------------------------------------------------------*/ -static struct cli_proto *cli_proto; /* XXX: what order should this list be in ? */ -static struct cli_proto mgt_cli_proto[] = { +static struct cli_proto cli_proto[] = { + { CLI_HELP, mcf_help, cli_proto }, { CLI_PING, cli_func_ping }, { CLI_SERVER_STATUS, mcf_server_status, NULL }, { CLI_SERVER_START, mcf_server_startstop, NULL }, @@ -158,7 +115,6 @@ { CLI_VCL_SHOW, mcf_config_show, NULL }, { CLI_PARAM_SHOW, mcf_param_show, NULL }, { CLI_PARAM_SET, mcf_param_set, NULL }, - { CLI_HELP, cli_func_help, NULL }, #if 0 { CLI_SERVER_RESTART }, { CLI_ZERO }, @@ -170,59 +126,13 @@ { NULL } }; - -/*--------------------------------------------------------------------*/ - -void -mgt_cli_init(void) -{ - struct cli_proto *cp; - unsigned u, v; - - /* - * Build the joint cli_proto by combining the manager process - * entries with with the cache process entries. The latter - * get a "passthough" function in the joint list - */ - u = 0; - for (cp = mgt_cli_proto; cp->request != NULL; cp++) - u++; - for (cp = CLI_cmds; cp->request != NULL; cp++) - u++; - cli_proto = calloc(sizeof *cli_proto, u + 1); - XXXAN(cli_proto); - u = 0; - for (cp = mgt_cli_proto; cp->request != NULL; cp++) - cli_proto[u++] = *cp; - for (cp = CLI_cmds; cp->request != NULL; cp++) { - /* Skip any cache commands we already have in the manager */ - for (v = 0; v < u; v++) - if (!strcmp(cli_proto[v].request, cp->request)) - break; - if (v < u) - continue; - cli_proto[u] = *cp; - cli_proto[u].func = mcf_passthru; - u++; - } - - /* Fixup the entry for 'help' entry */ - for (u = 0; cli_proto[u].request != NULL; u++) { - if (!strcmp(cli_proto[u].request, "help")) { - cli_proto[u].priv = cli_proto; - break; - } - } -} - /*-------------------------------------------------------------------- * Ask the child something over CLI, return zero only if everything is * happy happy. */ int -mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...) -{ +mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...) { char *p; int i, j; va_list ap; @@ -319,12 +229,41 @@ mgt_cli_vlu(void *priv, const char *p) { struct cli_port *cp; + char *q; + unsigned u; + int i; CAST_OBJ_NOTNULL(cp, priv, CLI_PORT_MAGIC); vsb_clear(cp->cli->sb); cli_dispatch(cp->cli, cli_proto, p); vsb_finish(cp->cli->sb); AZ(vsb_overflowed(cp->cli->sb)); + if (cp->cli->result == CLIS_UNKNOWN) { + /* + * Command not recognized in master, try cacher if it is + * running. + */ + vsb_clear(cp->cli->sb); + cp->cli->result = CLIS_OK; + if (cli_o <= 0) { + cli_result(cp->cli, CLIS_UNKNOWN); + cli_out(cp->cli, + "Unknown request in manager process " + "(child not running).\n" + "Type 'help' for more info."); + } else { + i = write(cli_o, p, strlen(p)); + xxxassert(i == strlen(p)); + i = write(cli_o, "\n", 1); + xxxassert(i == 1); + i = cli_readres(cli_i, &u, &q, params->cli_timeout); + cli_result(cp->cli, u); + cli_out(cp->cli, "%s", q); + free(q); + } + vsb_finish(cp->cli->sb); + AZ(vsb_overflowed(cp->cli->sb)); + } /* send the result back */ if (cli_writeres(cp->fdo, cp->cli)) Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2008-03-12 10:21:49 UTC (rev 2594) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2008-03-12 10:25:51 UTC (rev 2595) @@ -556,8 +556,6 @@ if (pfh != NULL && vpf_write(pfh)) fprintf(stderr, "NOTE: Could not write PID file\n"); - mgt_cli_init(); - mgt_run(d_flag, T_arg); if (pfh != NULL) Modified: trunk/varnish-cache/include/cli_common.h =================================================================== --- trunk/varnish-cache/include/cli_common.h 2008-03-12 10:21:49 UTC (rev 2594) +++ trunk/varnish-cache/include/cli_common.h 2008-03-12 10:25:51 UTC (rev 2595) @@ -37,6 +37,5 @@ int cli_writeres(int fd, const struct cli *cli); int cli_readres(int fd, unsigned *status, char **ptr, double tmo); -extern struct cli_proto CLI_cmds[]; cli_func_t cli_func_ping; From phk at projects.linpro.no Wed Mar 12 10:29:43 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 12 Mar 2008 11:29:43 +0100 (CET) Subject: r2596 - trunk/varnish-cache/bin/varnishd Message-ID: <20080312102943.39D6C1EC40C@projects.linpro.no> Author: phk Date: 2008-03-12 11:29:43 +0100 (Wed, 12 Mar 2008) New Revision: 2596 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_ban.c trunk/varnish-cache/bin/varnishd/cache_cli.c trunk/varnish-cache/bin/varnishd/cache_vcl.c Log: Give cacher private cli functions a private prefix of "ccf" instead of overloading common cli function namespace "cli_func". Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-03-12 10:25:51 UTC (rev 2595) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-03-12 10:29:43 UTC (rev 2596) @@ -415,8 +415,8 @@ /* cache_ban.c */ void AddBan(const char *, int hash); void BAN_Init(void); -void cli_func_url_purge(struct cli *cli, const char * const *av, void *priv); -void cli_func_hash_purge(struct cli *cli, const char * const *av, void *priv); +void ccf_url_purge(struct cli *cli, const char * const *av, void *priv); +void ccf_hash_purge(struct cli *cli, const char * const *av, void *priv); void BAN_NewObj(struct object *o); int BAN_CheckObject(struct object *o, const char *url, const char *hash); @@ -559,10 +559,10 @@ #undef VCL_RET_MAC #ifdef CLI_PRIV_H -cli_func_t cli_func_config_list; -cli_func_t cli_func_config_load; -cli_func_t cli_func_config_discard; -cli_func_t cli_func_config_use; +cli_func_t ccf_config_list; +cli_func_t ccf_config_load; +cli_func_t ccf_config_discard; +cli_func_t ccf_config_use; #endif /* cache_vrt_esi.c */ Modified: trunk/varnish-cache/bin/varnishd/cache_ban.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_ban.c 2008-03-12 10:25:51 UTC (rev 2595) +++ trunk/varnish-cache/bin/varnishd/cache_ban.c 2008-03-12 10:29:43 UTC (rev 2596) @@ -104,7 +104,7 @@ } void -cli_func_url_purge(struct cli *cli, const char * const *av, void *priv) +ccf_url_purge(struct cli *cli, const char * const *av, void *priv) { (void)priv; @@ -113,7 +113,7 @@ } void -cli_func_hash_purge(struct cli *cli, const char * const *av, void *priv) +ccf_hash_purge(struct cli *cli, const char * const *av, void *priv) { (void)priv; Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-03-12 10:25:51 UTC (rev 2595) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-03-12 10:29:43 UTC (rev 2596) @@ -75,7 +75,7 @@ /*--------------------------------------------------------------------*/ static void -cli_func_start(struct cli *cli, const char * const *av, void *priv) +ccf_start(struct cli *cli, const char * const *av, void *priv) { (void)cli; @@ -98,20 +98,20 @@ static struct cli_proto master_cmds[] = { { CLI_PING, cli_func_ping }, - { CLI_SERVER_START, cli_func_start }, - { CLI_VCL_LOAD, cli_func_config_load }, - { CLI_VCL_LIST, cli_func_config_list }, - { CLI_VCL_DISCARD, cli_func_config_discard }, - { CLI_VCL_USE, cli_func_config_use }, + { CLI_SERVER_START, ccf_start }, + { CLI_VCL_LOAD, ccf_config_load }, + { CLI_VCL_LIST, ccf_config_list }, + { CLI_VCL_DISCARD, ccf_config_discard }, + { CLI_VCL_USE, ccf_config_use }, { NULL } }; static struct cli_proto cacher_cmds[] = { { CLI_HELP, ccf_help, NULL }, - { CLI_URL_PURGE, cli_func_url_purge }, - { CLI_HASH_PURGE, cli_func_hash_purge }, + { CLI_URL_PURGE, ccf_url_purge }, + { CLI_HASH_PURGE, ccf_hash_purge }, #if 0 - { CLI_URL_QUERY, cli_func_url_query }, + { CLI_URL_QUERY, ccf_url_query }, #endif { NULL } }; Modified: trunk/varnish-cache/bin/varnishd/cache_vcl.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vcl.c 2008-03-12 10:25:51 UTC (rev 2595) +++ trunk/varnish-cache/bin/varnishd/cache_vcl.c 2008-03-12 10:29:43 UTC (rev 2596) @@ -209,7 +209,7 @@ /*--------------------------------------------------------------------*/ void -cli_func_config_list(struct cli *cli, const char * const *av, void *priv) +ccf_config_list(struct cli *cli, const char * const *av, void *priv) { struct vcls *vcl; @@ -225,7 +225,7 @@ } void -cli_func_config_load(struct cli *cli, const char * const *av, void *priv) +ccf_config_load(struct cli *cli, const char * const *av, void *priv) { (void)av; @@ -237,7 +237,7 @@ } void -cli_func_config_discard(struct cli *cli, const char * const *av, void *priv) +ccf_config_discard(struct cli *cli, const char * const *av, void *priv) { struct vcls *vcl; @@ -264,7 +264,7 @@ } void -cli_func_config_use(struct cli *cli, const char * const *av, void *priv) +ccf_config_use(struct cli *cli, const char * const *av, void *priv) { struct vcls *vcl; From phk at projects.linpro.no Wed Mar 12 13:46:35 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 12 Mar 2008 14:46:35 +0100 (CET) Subject: r2597 - in trunk/varnish-cache: include lib/libvarnish Message-ID: <20080312134635.433E61EC1D1@projects.linpro.no> Author: phk Date: 2008-03-12 14:46:34 +0100 (Wed, 12 Mar 2008) New Revision: 2597 Modified: trunk/varnish-cache/include/cli_priv.h trunk/varnish-cache/lib/libvarnish/cli.c Log: Add a CLI support function for concatenating two cli_proto tables in malloc'ed memory. Modified: trunk/varnish-cache/include/cli_priv.h =================================================================== --- trunk/varnish-cache/include/cli_priv.h 2008-03-12 10:29:43 UTC (rev 2596) +++ trunk/varnish-cache/include/cli_priv.h 2008-03-12 13:46:34 UTC (rev 2597) @@ -60,3 +60,4 @@ /* From libvarnish/cli.c */ void cli_dispatch(struct cli *cli, struct cli_proto *clp, const char *line); cli_func_t cli_func_help; +struct cli_proto *cli_concat(struct cli_proto *, struct cli_proto *); Modified: trunk/varnish-cache/lib/libvarnish/cli.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/cli.c 2008-03-12 10:29:43 UTC (rev 2596) +++ trunk/varnish-cache/lib/libvarnish/cli.c 2008-03-12 13:46:34 UTC (rev 2597) @@ -35,6 +35,7 @@ #include #include +#include #include #include @@ -131,3 +132,28 @@ } while (0); FreeArgv(av); } + +struct cli_proto * +cli_concat(struct cli_proto *c1, struct cli_proto *c2) +{ + struct cli_proto *c; + int i1, i2; + + i1 = 0; + for(c = c1; c != NULL && c->request != NULL; c++) + i1++; + i2 = 0; + for(c = c2; c != NULL && c->request != NULL; c++) + i2++; + + c = malloc(sizeof(*c) * (i1 + i2 + 1)); + if (c == NULL) + return (c); + if (c1 != NULL) + memcpy(c, c1, sizeof(*c1) * i1); + if (c2 != NULL) + memcpy(c + i1, c2, sizeof(*c2) * i2); + memset(c + i1 + i2, 0, sizeof(*c)); + return (c); +} + From phk at projects.linpro.no Wed Mar 12 14:07:08 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 12 Mar 2008 15:07:08 +0100 (CET) Subject: r2598 - trunk/varnish-cache/bin/varnishd Message-ID: <20080312140708.822E91EC6CD@projects.linpro.no> Author: phk Date: 2008-03-12 15:07:08 +0100 (Wed, 12 Mar 2008) New Revision: 2598 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/bin/varnishd/cache_ban.c trunk/varnish-cache/bin/varnishd/cache_cli.c trunk/varnish-cache/bin/varnishd/cache_main.c trunk/varnish-cache/bin/varnishd/cache_vcl.c trunk/varnish-cache/bin/varnishd/mgt.h Log: Further revamp the CLI handling in the cacher process, making it possible for various modules to add cli functions so they can be manipulated on the fly. CLI_AddFuncs() registers a set of CLI functions. We operate with three lists: the ones not shown in "help" because the manager already showed them, the normal ones and the debug commands which are also not shown in a plain "help". Move the registration of cli functions out to the code they belong in: VCL, BAN and VCA. Give VCA a real Init function, and have the cli function ("start") initiate the acceptor thread which listens for incoming connections. Split CLI_Init() into CLI_Init() and CLI_Run() Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-03-12 13:46:34 UTC (rev 2597) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-03-12 14:07:08 UTC (rev 2598) @@ -79,6 +79,7 @@ struct addrinfo; struct esi_bit; struct vrt_backend; +struct cli_proto; /*--------------------------------------------------------------------*/ @@ -415,8 +416,6 @@ /* cache_ban.c */ void AddBan(const char *, int hash); void BAN_Init(void); -void ccf_url_purge(struct cli *cli, const char * const *av, void *priv); -void ccf_hash_purge(struct cli *cli, const char * const *av, void *priv); void BAN_NewObj(struct object *o); int BAN_CheckObject(struct object *o, const char *url, const char *hash); @@ -426,6 +425,9 @@ /* cache_cli.c [CLI] */ void CLI_Init(void); +void CLI_Run(void); +enum cli_set_e {MASTER_CLI, PUBLIC_CLI, DEBUG_CLI}; +void CLI_AddFuncs(enum cli_set_e which, struct cli_proto *p); extern pthread_t cli_thread; #define ASSERT_CLI() do {assert(pthread_self() == cli_thread);} while (0) @@ -558,13 +560,6 @@ #undef VCL_MET_MAC #undef VCL_RET_MAC -#ifdef CLI_PRIV_H -cli_func_t ccf_config_list; -cli_func_t ccf_config_load; -cli_func_t ccf_config_discard; -cli_func_t ccf_config_use; -#endif - /* cache_vrt_esi.c */ void ESI_Deliver(struct sess *); Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2008-03-12 13:46:34 UTC (rev 2597) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2008-03-12 14:07:08 UTC (rev 2598) @@ -50,6 +50,8 @@ #include "compat/srandomdev.h" #endif +#include "cli.h" +#include "cli_priv.h" #include "shmlog.h" #include "cache.h" #include "cache_acceptor.h" @@ -274,11 +276,13 @@ /*--------------------------------------------------------------------*/ -void -VCA_Init(void) +static void +ccf_start(struct cli *cli, const char * const *av, void *priv) { - + (void)cli; + (void)av; + (void)priv; /* XXX: Add selector mechanism at some point */ vca_act = vca_acceptors[0]; @@ -291,3 +295,15 @@ AZ(pthread_create(&vca_thread_acct, NULL, vca_acct, NULL)); VSL(SLT_Debug, 0, "Acceptor is %s", vca_act->name); } + +static struct cli_proto vca_cmds[] = { + { CLI_SERVER_START, ccf_start }, + { NULL } +}; + +void +VCA_Init(void) +{ + + CLI_AddFuncs(MASTER_CLI, vca_cmds); +} Modified: trunk/varnish-cache/bin/varnishd/cache_ban.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_ban.c 2008-03-12 13:46:34 UTC (rev 2597) +++ trunk/varnish-cache/bin/varnishd/cache_ban.c 2008-03-12 14:07:08 UTC (rev 2598) @@ -40,6 +40,7 @@ #include #include "shmlog.h" +#include "cli.h" #include "cli_priv.h" #include "cache.h" @@ -103,7 +104,7 @@ return (0); } -void +static void ccf_url_purge(struct cli *cli, const char * const *av, void *priv) { @@ -112,7 +113,7 @@ cli_out(cli, "PURGE %s\n", av[2]); } -void +static void ccf_hash_purge(struct cli *cli, const char * const *av, void *priv) { @@ -121,9 +122,16 @@ cli_out(cli, "PURGE %s\n", av[2]); } +static struct cli_proto ban_cmds[] = { + { CLI_URL_PURGE, ccf_url_purge }, + { CLI_HASH_PURGE, ccf_hash_purge }, + { NULL } +}; + void BAN_Init(void) { + CLI_AddFuncs(PUBLIC_CLI, ban_cmds); AddBan("\001", 0); } Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-03-12 13:46:34 UTC (rev 2597) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-03-12 14:07:08 UTC (rev 2598) @@ -27,6 +27,13 @@ * SUCH DAMAGE. * * $Id$ + * + * Caching process CLI handling. + * + * We only have one CLI source, the stdin/stdout pipes from the manager + * process, but we complicate things by having undocumented commands that + * we do not want to show in a plain help, and by having commands that the + * manager has already shown in help before asking us. */ #include "config.h" @@ -47,106 +54,45 @@ #include "vsb.h" pthread_t cli_thread; +static MTX cli_mtx; -/*--------------------------------------------------------------------*/ +/* + * The CLI commandlist is split in three: + * - Commands we get from/share with the manager, we don't show these + * in help, as the manager already did that. + * - Cache process commands, show in help + * - Undocumented debug commands, show in undocumented "help -d" + */ -static void -cli_debug_sizeof(struct cli *cli, const char * const *av, void *priv) -{ - (void)av; - (void)priv; +static struct cli_proto *ccf_master_cli, *ccf_public_cli, *ccf_debug_cli; -#define SZOF(foo) cli_out(cli, \ - "sizeof(%s) = %zd = 0x%zx\n", #foo, sizeof(foo), sizeof(foo)); - SZOF(struct ws); - SZOF(struct http); - SZOF(struct http_conn); - SZOF(struct acct); - SZOF(struct worker); - SZOF(struct workreq); - SZOF(struct bereq); - SZOF(struct storage); - SZOF(struct object); - SZOF(struct objhead); - SZOF(struct sess); - SZOF(struct vbe_conn); -} - -/*--------------------------------------------------------------------*/ - -static void -ccf_start(struct cli *cli, const char * const *av, void *priv) -{ - - (void)cli; - (void)av; - (void)priv; - VCA_Init(); - return; -} - -/*--------------------------------------------------------------------*/ - -static void ccf_help(struct cli *cli, const char * const *av, void *priv); - /*-------------------------------------------------------------------- - * The CLI commandlist is split in three: - * Commands we get from/share with the manager - * Cache process commands - * Undocumented commands + * Add CLI functions to the appropriate command set */ -static struct cli_proto master_cmds[] = { - { CLI_PING, cli_func_ping }, - { CLI_SERVER_START, ccf_start }, - { CLI_VCL_LOAD, ccf_config_load }, - { CLI_VCL_LIST, ccf_config_list }, - { CLI_VCL_DISCARD, ccf_config_discard }, - { CLI_VCL_USE, ccf_config_use }, - { NULL } -}; - -static struct cli_proto cacher_cmds[] = { - { CLI_HELP, ccf_help, NULL }, - { CLI_URL_PURGE, ccf_url_purge }, - { CLI_HASH_PURGE, ccf_hash_purge }, -#if 0 - { CLI_URL_QUERY, ccf_url_query }, -#endif - { NULL } -}; - -static struct cli_proto undoc_cmds[] = { - { "debug.sizeof", "debug.sizeof", - "\tDump sizeof various data structures\n", - 0, 0, cli_debug_sizeof }, - { NULL } -}; - - -/*--------------------------------------------------------------------*/ - -static void -ccf_help(struct cli *cli, const char * const *av, void *priv) +void +CLI_AddFuncs(enum cli_set_e which, struct cli_proto *p) { + struct cli_proto *c, **cp; - (void)priv; - /* "+1" to skip "help" entry, manager already did that. */ - cli_func_help(cli, av, cacher_cmds + 1); - - if (av[2] != NULL && !strcmp(av[2], "-d")) { - /* Also list undocumented commands */ - cli_out(cli, "\nDebugging commands:\n"); - cli_func_help(cli, av, undoc_cmds); - } else if (cli->result == CLIS_UNKNOWN) { - /* Otherwise, try the undocumented list */ - vsb_clear(cli->sb); - cli->result = CLIS_OK; - cli_func_help(cli, av, undoc_cmds); + switch (which) { + case MASTER_CLI: cp = &ccf_master_cli; break; + case PUBLIC_CLI: cp = &ccf_public_cli; break; + case DEBUG_CLI: cp = &ccf_debug_cli; break; + default: INCOMPL(); } + LOCK(&cli_mtx); + c = cli_concat(*cp, p); + AN(c); + free(*cp); + *cp = c; + UNLOCK(&cli_mtx); } -/*--------------------------------------------------------------------*/ +/*-------------------------------------------------------------------- + * Called when we have a full line, look through all three command + * lists to find it. + */ static int cli_vlu(void *priv, const char *p) @@ -157,17 +103,19 @@ cli = priv; VSL(SLT_CLI, 0, "Rd %s", p); vsb_clear(cli->sb); - cli_dispatch(cli, master_cmds, p); + LOCK(&cli_mtx); + cli_dispatch(cli, ccf_master_cli, p); if (cli->result == CLIS_UNKNOWN) { vsb_clear(cli->sb); cli->result = CLIS_OK; - cli_dispatch(cli, cacher_cmds, p); + cli_dispatch(cli, ccf_public_cli, p); } if (cli->result == CLIS_UNKNOWN) { vsb_clear(cli->sb); cli->result = CLIS_OK; - cli_dispatch(cli, undoc_cmds, p); + cli_dispatch(cli, ccf_debug_cli, p); } + UNLOCK(&cli_mtx); vsb_finish(cli->sb); AZ(vsb_overflowed(cli->sb)); i = cli_writeres(heritage.fds[1], cli); @@ -179,8 +127,12 @@ return (0); } +/*-------------------------------------------------------------------- + * Run CLI on stdin/stdout pipe from manager + */ + void -CLI_Init(void) +CLI_Run(void) { struct pollfd pfd[1]; struct cli *cli, clis; @@ -190,7 +142,6 @@ cli = &clis; memset(cli, 0, sizeof *cli); - cli_thread = pthread_self(); cli->sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); XXXAN(cli->sb); vlu = VLU_New(cli, cli_vlu, params->cli_buffer); @@ -219,3 +170,80 @@ } } } + +/*--------------------------------------------------------------------*/ + +static void +cli_debug_sizeof(struct cli *cli, const char * const *av, void *priv) +{ + (void)av; + (void)priv; + +#define SZOF(foo) cli_out(cli, \ + "sizeof(%s) = %zd = 0x%zx\n", #foo, sizeof(foo), sizeof(foo)); + SZOF(struct ws); + SZOF(struct http); + SZOF(struct http_conn); + SZOF(struct acct); + SZOF(struct worker); + SZOF(struct workreq); + SZOF(struct bereq); + SZOF(struct storage); + SZOF(struct object); + SZOF(struct objhead); + SZOF(struct sess); + SZOF(struct vbe_conn); +} + +/*--------------------------------------------------------------------*/ + +static void +ccf_help(struct cli *cli, const char * const *av, void *priv) +{ + + (void)priv; + cli_func_help(cli, av, ccf_public_cli); + + if (av[2] != NULL && !strcmp(av[2], "-d")) { + /* Also list undocumented commands */ + cli_out(cli, "\nDebugging commands:\n"); + cli_func_help(cli, av, ccf_debug_cli); + } else if (cli->result == CLIS_UNKNOWN) { + /* Otherwise, try the undocumented list */ + vsb_clear(cli->sb); + cli->result = CLIS_OK; + cli_func_help(cli, av, ccf_debug_cli); + } +} + +/*--------------------------------------------------------------------*/ + +static struct cli_proto master_cmds[] = { + { CLI_PING, cli_func_ping }, + { CLI_HELP, ccf_help, NULL }, + { NULL } +}; + +static struct cli_proto debug_cmds[] = { + { "debug.sizeof", "debug.sizeof", + "\tDump sizeof various data structures\n", + 0, 0, cli_debug_sizeof }, + { NULL } +}; + + +/*-------------------------------------------------------------------- + * Initialize the CLI subsystem + */ + +void +CLI_Init(void) +{ + + MTX_INIT(&cli_mtx); + cli_thread = pthread_self(); + + CLI_AddFuncs(MASTER_CLI, master_cmds); + CLI_AddFuncs(DEBUG_CLI, debug_cmds); +} + Modified: trunk/varnish-cache/bin/varnishd/cache_main.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_main.c 2008-03-12 13:46:34 UTC (rev 2597) +++ trunk/varnish-cache/bin/varnishd/cache_main.c 2008-03-12 14:07:08 UTC (rev 2598) @@ -71,6 +71,8 @@ THR_Name("cache-main"); + CLI_Init(); + CNT_Init(); VCL_Init(); @@ -85,11 +87,13 @@ HSH_Init(); BAN_Init(); + VCA_Init(); + STV_open(); VSL_stats->start_time = (time_t)TIM_real(); - CLI_Init(); + CLI_Run(); printf("Child dies\n"); } Modified: trunk/varnish-cache/bin/varnishd/cache_vcl.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vcl.c 2008-03-12 13:46:34 UTC (rev 2597) +++ trunk/varnish-cache/bin/varnishd/cache_vcl.c 2008-03-12 14:07:08 UTC (rev 2598) @@ -208,7 +208,7 @@ /*--------------------------------------------------------------------*/ -void +static void ccf_config_list(struct cli *cli, const char * const *av, void *priv) { struct vcls *vcl; @@ -224,7 +224,7 @@ } } -void +static void ccf_config_load(struct cli *cli, const char * const *av, void *priv) { @@ -236,7 +236,7 @@ return; } -void +static void ccf_config_discard(struct cli *cli, const char * const *av, void *priv) { struct vcls *vcl; @@ -263,7 +263,7 @@ VCL_Nuke(vcl); } -void +static void ccf_config_use(struct cli *cli, const char * const *av, void *priv) { struct vcls *vcl; @@ -321,9 +321,18 @@ /*--------------------------------------------------------------------*/ +static struct cli_proto vcl_cmds[] = { + { CLI_VCL_LOAD, ccf_config_load }, + { CLI_VCL_LIST, ccf_config_list }, + { CLI_VCL_DISCARD, ccf_config_discard }, + { CLI_VCL_USE, ccf_config_use }, + { NULL } +}; + void VCL_Init() { + CLI_AddFuncs(MASTER_CLI, vcl_cmds); MTX_INIT(&vcl_mtx); } Modified: trunk/varnish-cache/bin/varnishd/mgt.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt.h 2008-03-12 13:46:34 UTC (rev 2597) +++ trunk/varnish-cache/bin/varnishd/mgt.h 2008-03-12 14:07:08 UTC (rev 2598) @@ -44,7 +44,6 @@ /* mgt_cli.c */ -void mgt_cli_init(void); void mgt_cli_setup(int fdi, int fdo, int verbose, const char *ident); int mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...); void mgt_cli_start_child(int fdi, int fdo); From des at projects.linpro.no Wed Mar 12 15:11:00 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Wed, 12 Mar 2008 16:11:00 +0100 (CET) Subject: r2599 - trunk/varnish-tools/fetcher Message-ID: <20080312151100.40D751EC40C@projects.linpro.no> Author: des Date: 2008-03-12 16:11:00 +0100 (Wed, 12 Mar 2008) New Revision: 2599 Modified: trunk/varnish-tools/fetcher/fetcher.pl Log: Refactor, implement random mode. Modified: trunk/varnish-tools/fetcher/fetcher.pl =================================================================== --- trunk/varnish-tools/fetcher/fetcher.pl 2008-03-12 14:07:08 UTC (rev 2598) +++ trunk/varnish-tools/fetcher/fetcher.pl 2008-03-12 15:11:00 UTC (rev 2599) @@ -43,11 +43,12 @@ use Time::HiRes qw(gettimeofday tv_interval); use URI; +our %URLS; our %BANNED; -our %TODO; -our %DONE; +our @TODO; our %CHILD; our $BUSY; +our $DONE; our $continue = 0; our $delay = 0; @@ -144,10 +145,8 @@ die "child busy\n" if $$child{'url'}; return undef - unless (keys(%TODO)); - my $url = (keys(%TODO))[0]; - $DONE{$url} = $TODO{$url}; - delete $TODO{$url}; + unless (@TODO); + my $url = shift(@TODO); $$child{'url'} = $url; $$child{'fh'}->write("$url\n"); ++$BUSY; @@ -162,8 +161,7 @@ my $uri = URI->new_abs($1, $$child{'url'}); $url = $uri->canonical; $BANNED{$url} = 1; - delete $TODO{$url}; - delete $DONE{$url}; + delete $URLS{$url}; print(STDERR "Banned $url\n") unless ($quiet > 2); } @@ -183,8 +181,9 @@ unless ($quiet > 0); return; } - return if $TODO{$url} || $DONE{$url}; - $TODO{$url} = 1; + return if $URLS{$url}; + $URLS{$url} = 1; + push(@TODO, $url); } # Called when mux gets data from a client @@ -199,6 +198,7 @@ if ($line eq "ready") { $$child{'url'} = ''; --$BUSY; + ++$DONE; $mux->endloop(); } elsif ($line =~ m/^add (.*?)$/) { get_url($child, $1); @@ -210,16 +210,10 @@ } } -sub fetcher(@) { - my (@urls) = @_; +my $mux = new IO::Multiplex; - my $mux = new IO::Multiplex; +sub breed() { - # prepare work queue - foreach my $url (@urls) { - $TODO{URI->new($url)->canonical} = 1; - } - # start children $BUSY = 0; for (my $i = 0; $i < $jobs; ++$i) { @@ -241,51 +235,115 @@ $mux->set_callback_object($child, $s1); } } +} - # main loop +sub infanticide() { + + foreach my $child (values(%CHILD)) { + $child->send("done"); + $$child{'fh'}->close(); + } +} + +sub harvest(@) { + my (@urls) = @_; + + # prepare work queue + foreach my $url (@urls) { + push(@TODO, URI->new($url)->canonical); + } + + $DONE = 0; for (;;) { - my $t0 = [gettimeofday()]; + foreach my $child (values(%CHILD)) { + $child->send_url() + unless $$child{'url'}; + } + printf(STDERR " %d/%d \r", + int(keys(%URLS)) - @TODO, int(keys(%URLS))) + unless ($quiet > 3); + last unless $BUSY; + $mux->loop(); + } +} - # keep dispatching URLs until we're done - for (;;) { +sub summarize($$$) { + my ($count, $t0, $t1) = @_; + + my $dt = tv_interval($t0, $t1); + printf(STDERR "retrieved %d documents in %.2f seconds - %.2f tps\n", + $count, $dt, $count / $dt) + unless ($quiet > 3); +} + +sub fetch_random() { + + my $t0 = [gettimeofday()]; + my @urls = keys(%URLS); + @TODO = @urls; + $DONE = 0; + + while (@TODO) { + foreach my $child (values(%CHILD)) { + $child->send_url() + unless $$child{'url'}; + push(@TODO, $urls[rand(@urls)]); + } + $mux->loop(); + printf(STDERR " %d \r", $DONE) + unless ($quiet > 3); + if ($DONE > 0 && ($DONE % 1000) == 0) { + my $t1 = [gettimeofday()]; + summarize(1000, $t0, $t1); + $t0 = $t1; + } + } +} + +sub fetch_sequential() { + + my $t0 = [gettimeofday()]; + for (;;) { + @TODO = keys(%URLS); + $DONE = 0; + + while (@TODO) { foreach my $child (values(%CHILD)) { $child->send_url() unless $$child{'url'}; } - printf(STDERR " %d/%d \r", int(keys(%DONE)), - int(keys(%DONE)) + int(keys(%TODO))) + printf(STDERR " %d/%d \r", $DONE, int(keys(%URLS))) unless ($quiet > 3); last unless $BUSY; $mux->loop(); } + my $t1 = [gettimeofday()]; + summarize(int(keys(%URLS)), $t0, $t1); + $t0 = $t1; + } +} - # summarize - my $dt = tv_interval($t0, [gettimeofday()]); - my $count = int(keys(%DONE)) + int(keys(%BANNED)); - printf(STDERR "retrieved %d documents in %.2f seconds - %.2f tps\n", - $count, $dt, $count / $dt) - unless ($quiet > 3); +sub fetcher(@) { + my (@urls) = @_; - last unless $continue; - foreach my $child (values(%CHILD)) { - $child->send("no check"); - } - %BANNED = (); - %TODO = %DONE; - %DONE = (); - } + breed(); - # done + my $t0 = [gettimeofday()]; + harvest(@urls); + my $t1 = [gettimeofday()]; + summarize(int(keys(%URLS)), $t0, $t1); + foreach my $child (values(%CHILD)) { - $child->send("done"); - $$child{'fh'}->close(); + $child->send("no check"); } -} -sub refetch() { + if ($random) { + fetch_random(); + } elsif ($continue) { + fetch_sequential(); + } - # Recycle valid URLs from initial run - %TODO = %DONE; + infanticide(); } sub usage() { @@ -303,8 +361,6 @@ or usage(); $jobs > 0 or usage(); - $random - and die "-r is not yet implemented\n"; @ARGV or usage(); fetcher(@ARGV); From ssm at projects.linpro.no Thu Mar 13 05:59:19 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Thu, 13 Mar 2008 06:59:19 +0100 (CET) Subject: r2600 - trunk/varnish-cache/debian Message-ID: <20080313055919.C38611EC418@projects.linpro.no> Author: ssm Date: 2008-03-13 06:59:19 +0100 (Thu, 13 Mar 2008) New Revision: 2600 Modified: trunk/varnish-cache/debian/varnish.docs Log: Debian packaging: Do not include the upstream INSTALL file Modified: trunk/varnish-cache/debian/varnish.docs =================================================================== --- trunk/varnish-cache/debian/varnish.docs 2008-03-12 15:11:00 UTC (rev 2599) +++ trunk/varnish-cache/debian/varnish.docs 2008-03-13 05:59:19 UTC (rev 2600) @@ -1,3 +1,2 @@ README -INSTALL doc/*.html From ssm at projects.linpro.no Thu Mar 13 06:00:10 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Thu, 13 Mar 2008 07:00:10 +0100 (CET) Subject: r2601 - in branches/1.2: . debian Message-ID: <20080313060010.C7AFE1EC40C@projects.linpro.no> Author: ssm Date: 2008-03-13 07:00:10 +0100 (Thu, 13 Mar 2008) New Revision: 2601 Modified: branches/1.2/ branches/1.2/debian/varnish.docs Log: Merged revisions 2600 via svnmerge from svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache ........ r2600 | ssm | 2008-03-13 06:59:19 +0100 (Thu, 13 Mar 2008) | 1 line Debian packaging: Do not include the upstream INSTALL file ........ Property changes on: branches/1.2 ___________________________________________________________________ Name: svnmerge-integrated - /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2288-2291,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317-2319,2321-2327,2329-2330,2337,2357-2359,2361-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2520-2524,2545,2563-2579,2581-2583,2586,2588 + /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2288-2291,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317-2319,2321-2327,2329-2330,2337,2357-2359,2361-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2520-2524,2545,2563-2579,2581-2583,2586,2588,2600 Modified: branches/1.2/debian/varnish.docs =================================================================== --- branches/1.2/debian/varnish.docs 2008-03-13 05:59:19 UTC (rev 2600) +++ branches/1.2/debian/varnish.docs 2008-03-13 06:00:10 UTC (rev 2601) @@ -1,3 +1,2 @@ README -INSTALL doc/*.html From phk at projects.linpro.no Thu Mar 13 10:14:10 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 13 Mar 2008 11:14:10 +0100 (CET) Subject: r2602 - trunk/varnish-cache/bin/varnishd Message-ID: <20080313101410.8ADAE1EC422@projects.linpro.no> Author: phk Date: 2008-03-13 11:14:10 +0100 (Thu, 13 Mar 2008) New Revision: 2602 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c Log: Don't shmlog ECONNABORTED Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2008-03-13 06:00:10 UTC (rev 2601) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2008-03-13 10:14:10 UTC (rev 2602) @@ -203,7 +203,7 @@ addr = (void*)&addr_s; i = accept(pfd[u].fd, addr, &l); if (i < 0) { - if (errno != EAGAIN) { + if (errno != EAGAIN && errno != ECONNABORTED) { VSL(SLT_Debug, pfd[u].fd, "Accept failed errno=%d", errno); /* XXX: stats ? */ From phk at projects.linpro.no Thu Mar 13 10:29:14 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 13 Mar 2008 11:29:14 +0100 (CET) Subject: r2603 - trunk/varnish-cache/bin/varnishd Message-ID: <20080313102914.DC5EB1EC40C@projects.linpro.no> Author: phk Date: 2008-03-13 11:29:14 +0100 (Thu, 13 Mar 2008) New Revision: 2603 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c trunk/varnish-cache/bin/varnishd/cache_expire.c trunk/varnish-cache/bin/varnishd/cache_hash.c trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c trunk/varnish-cache/bin/varnishd/cache_ws.c Log: Add a DSL() macro for diagnostic shmlogging and use it. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-03-13 10:14:10 UTC (rev 2602) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-03-13 10:29:14 UTC (rev 2603) @@ -524,9 +524,17 @@ void WSLR(struct worker *w, enum shmlogtag tag, int id, txt t); void WSL(struct worker *w, enum shmlogtag tag, int id, const char *fmt, ...); void WSL_Flush(struct worker *w, int overflow); -#define WSP(sess, tag, fmt, ...) \ - WSL((sess)->wrk, tag, (sess)->fd, fmt, __VA_ARGS__) -#define WSPR(sess, tag, txt) \ + +#define DSL(flag, tag, id, ...) \ + do { \ + if (params->diag_bitmap & (flag)) \ + VSL((tag), (id), __VA_ARGS__); \ + } while (0) + +#define WSP(sess, tag, ...) \ + WSL((sess)->wrk, tag, (sess)->fd, __VA_ARGS__) + +#define WSPR(sess, tag, txt) \ WSLR((sess)->wrk, tag, (sess)->fd, txt) #define INCOMPL() do { \ Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2008-03-13 10:14:10 UTC (rev 2602) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2008-03-13 10:29:14 UTC (rev 2603) @@ -83,8 +83,7 @@ CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); assert(sp->fd >= 0); - if (params->diag_bitmap & 4) - VSL(SLT_Debug, sp->fd, "KQ: EV_SET sp %p arm %x", sp, arm); + DSL(0x04, SLT_Debug, sp->fd, "KQ: EV_SET sp %p arm %x", sp, arm); EV_SET(&ki[nki], sp->fd, EVFILT_READ, arm, 0, 0, sp); if (++nki == NKEV) vca_kq_flush(); @@ -116,10 +115,9 @@ return; } CAST_OBJ_NOTNULL(sp, kp->udata, SESS_MAGIC); - if (params->diag_bitmap & 0x4) - VSL(SLT_Debug, sp->id, "KQ: sp %p kev data %lu flags 0x%x%s", - sp, (unsigned long)kp->data, kp->flags, - (kp->flags & EV_EOF) ? " EOF" : ""); + DSL(0x04, SLT_Debug, sp->id, "KQ: sp %p kev data %lu flags 0x%x%s", + sp, (unsigned long)kp->data, kp->flags, + (kp->flags & EV_EOF) ? " EOF" : ""); spassert(sp->id == kp->ident); spassert(sp->fd == sp->id); Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_expire.c 2008-03-13 10:14:10 UTC (rev 2602) +++ trunk/varnish-cache/bin/varnishd/cache_expire.c 2008-03-13 10:29:14 UTC (rev 2603) @@ -402,7 +402,7 @@ o = oe->obj; if (sp->handling == VCL_RET_DISCARD) { - VSL(SLT_ExpKill, 0, "%u LRU", o->xid); + WSL(sp->wrk, SLT_ExpKill, 0, "%u LRU", o->xid); del_objexp(o); HSH_Deref(o); return (1); Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_hash.c 2008-03-13 10:14:10 UTC (rev 2602) +++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2008-03-13 10:29:14 UTC (rev 2603) @@ -278,8 +278,7 @@ if (sp == NULL) return; VTAILQ_REMOVE(&oh->waitinglist, sp, list); - if (params->diag_bitmap & 0x20) - VSL(SLT_Debug, sp->id, "off waiting list"); + DSL(0x20, SLT_Debug, sp->id, "off waiting list"); WRK_QueueSession(sp); } } @@ -365,9 +364,8 @@ if (r != 0) return; - if (params->diag_bitmap & 0x40) - VSL(SLT_Debug, 0, "Object %u workspace min free %u", - o->xid, WS_Free(o->ws_o)); + DSL(0x40, SLT_Debug, 0, "Object %u workspace min free %u", + o->xid, WS_Free(o->ws_o)); if (o->vary != NULL) free(o->vary); Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c 2008-03-13 10:14:10 UTC (rev 2602) +++ trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c 2008-03-13 10:29:14 UTC (rev 2603) @@ -619,7 +619,7 @@ if (sp->cur_method != VCL_MET_FETCH) { /* XXX: we should catch this at compile time */ WSP(sp, SLT_VCL_error, - "esi can only be called from vcl_fetch", ""); + "esi can only be called from vcl_fetch"); return; } Modified: trunk/varnish-cache/bin/varnishd/cache_ws.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_ws.c 2008-03-13 10:14:10 UTC (rev 2602) +++ trunk/varnish-cache/bin/varnishd/cache_ws.c 2008-03-13 10:29:14 UTC (rev 2603) @@ -46,19 +46,12 @@ #include "cli_priv.h" #include "cache.h" -/* Enable this to get detailed logging of WS usage */ -#define WS_DEBUG(fmt, ...) \ - do { \ - if (params->diag_bitmap & 0x2) \ - VSL(SLT_Debug, 0, fmt, __VA_ARGS__); \ - } while (0) - void WS_Assert(const struct ws *ws) { CHECK_OBJ_NOTNULL(ws, WS_MAGIC); - WS_DEBUG("WS(%p = (%s, %p %u %u %u)", + DSL(0x02, 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)); @@ -77,7 +70,8 @@ WS_Init(struct ws *ws, const char *id, void *space, unsigned len) { - WS_DEBUG("WS_Init(%p, \"%s\", %p, %u)", ws, id, space, len); + DSL(0x02, SLT_Debug, 0, + "WS_Init(%p, \"%s\", %p, %u)", ws, id, space, len); assert(space != NULL); memset(ws, 0, sizeof *ws); ws->magic = WS_MAGIC; @@ -93,7 +87,7 @@ { WS_Assert(ws); - WS_DEBUG("WS_Reset(%p, %p)", ws, p); + DSL(0x02, SLT_Debug, 0, "WS_Reset(%p, %p)", ws, p); assert(ws->r == NULL); if (p == NULL) ws->f = ws->s; @@ -117,7 +111,7 @@ } r = ws->f; ws->f += bytes; - WS_DEBUG("WS_Alloc(%p, %u) = %p", ws, bytes, r); + DSL(0x02, SLT_Debug, 0, "WS_Alloc(%p, %u) = %p", ws, bytes, r); return (r); } @@ -131,7 +125,7 @@ p = WS_Alloc(ws, l); if (p != NULL) memcpy(p, s, l); - WS_DEBUG("WS_Dup(%p, \"%s\") = %p", ws, s, p); + DSL(0x02, SLT_Debug, 0, "WS_Dup(%p, \"%s\") = %p", ws, s, p); return (p); } @@ -149,7 +143,7 @@ WS_Assert(ws); assert(ws->r == NULL); - WS_DEBUG("WS_Snapshot(%p) = %p", ws, ws->f); + DSL(0x02, SLT_Debug, 0, "WS_Snapshot(%p) = %p", ws, ws->f); return (ws->f); } @@ -164,7 +158,7 @@ b2 = ws->e - ws->f; xxxassert(ws->f + b2 <= ws->e); ws->r = ws->f + b2; - WS_DEBUG("WS_Reserve(%p, %u/%u) = %u", + DSL(0x02, SLT_Debug, 0, "WS_Reserve(%p, %u/%u) = %u", ws, b2, bytes, pdiff(ws->f, ws->r)); return (pdiff(ws->f, ws->r)); } @@ -173,7 +167,7 @@ WS_Release(struct ws *ws, unsigned bytes) { WS_Assert(ws); - WS_DEBUG("WS_Release(%p, %u)", ws, bytes); + DSL(0x02, SLT_Debug, 0, "WS_Release(%p, %u)", ws, bytes); assert(ws->r != NULL); assert(ws->f + bytes <= ws->r); ws->f += bytes; @@ -184,7 +178,7 @@ WS_ReleaseP(struct ws *ws, char *ptr) { WS_Assert(ws); - WS_DEBUG("WS_ReleaseP(%p, %p)", ws, ptr); + DSL(0x02, SLT_Debug, 0, "WS_ReleaseP(%p, %p)", ws, ptr); assert(ws->r != NULL); assert(ptr >= ws->f); assert(ptr <= ws->r); From phk at projects.linpro.no Thu Mar 13 10:34:31 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 13 Mar 2008 11:34:31 +0100 (CET) Subject: r2604 - trunk/varnish-cache/bin/varnishd Message-ID: <20080313103431.42EDE1EC418@projects.linpro.no> Author: phk Date: 2008-03-13 11:34:30 +0100 (Thu, 13 Mar 2008) New Revision: 2604 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/shmlog.c Log: Make VSLR() static, it's unused outside shmlog.c Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-03-13 10:29:14 UTC (rev 2603) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-03-13 10:34:30 UTC (rev 2604) @@ -519,7 +519,6 @@ void VSL_Init(void); #ifdef SHMLOGHEAD_MAGIC -void VSLR(enum shmlogtag tag, int id, txt t); void VSL(enum shmlogtag tag, int id, const char *fmt, ...); void WSLR(struct worker *w, enum shmlogtag tag, int id, txt t); void WSL(struct worker *w, enum shmlogtag tag, int id, const char *fmt, ...); Modified: trunk/varnish-cache/bin/varnishd/shmlog.c =================================================================== --- trunk/varnish-cache/bin/varnishd/shmlog.c 2008-03-13 10:29:14 UTC (rev 2603) +++ trunk/varnish-cache/bin/varnishd/shmlog.c 2008-03-13 10:34:30 UTC (rev 2604) @@ -95,7 +95,7 @@ * taking the detour over sprintf() */ -void +static void VSLR(enum shmlogtag tag, int id, txt t) { unsigned char *p; From phk at projects.linpro.no Thu Mar 13 12:49:37 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 13 Mar 2008 13:49:37 +0100 (CET) Subject: r2605 - trunk/varnish-cache/bin/varnishd Message-ID: <20080313124937.2F4831EC40C@projects.linpro.no> Author: phk Date: 2008-03-13 13:49:36 +0100 (Thu, 13 Mar 2008) New Revision: 2605 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_pool.c Log: Use a private cond-var for each worker thread, instead of pipe(2)-pair, it is cheaper. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-03-13 10:34:30 UTC (rev 2604) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-03-13 12:49:36 UTC (rev 2605) @@ -174,7 +174,7 @@ double used; - int pipe[2]; + pthread_cond_t cond; VTAILQ_ENTRY(worker) list; struct workreq *wrq; Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pool.c 2008-03-13 10:34:30 UTC (rev 2604) +++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2008-03-13 12:49:36 UTC (rev 2605) @@ -203,7 +203,6 @@ { struct worker *w, ww; struct wq *qp; - char c; unsigned char wlog[8192]; /* XXX: size */ THR_Name("cache-worker"); @@ -214,7 +213,7 @@ w->used = TIM_real(); w->wlb = w->wlp = wlog; w->wle = wlog + sizeof wlog; - AZ(pipe(w->pipe)); + AZ(pthread_cond_init(&w->cond, NULL)); VSL(SLT_WorkThread, 0, "%p start", w); LOCK(&tmtx); @@ -240,8 +239,8 @@ if (w->wrq == NULL) { LOCK(&qp->mtx); VTAILQ_INSERT_HEAD(&qp->idle, w, list); + AZ(pthread_cond_wait(&w->cond, &qp->mtx)); UNLOCK(&qp->mtx); - assert(1 == read(w->pipe[0], &c, 1)); } if (w->wrq == NULL) break; @@ -256,8 +255,7 @@ VSL(SLT_WorkThread, 0, "%p end", w); if (w->vcl != NULL) VCL_Rel(&w->vcl); - AZ(close(w->pipe[0])); - AZ(close(w->pipe[1])); + AZ(pthread_cond_destroy(&w->cond)); if (w->srcaddr != NULL) free(w->srcaddr); if (w->nobjhead != NULL) { @@ -295,7 +293,7 @@ VTAILQ_REMOVE(&qp->idle, w, list); UNLOCK(&qp->mtx); w->wrq = &sp->workreq; - assert(1 == write(w->pipe[1], w, 1)); + AZ(pthread_cond_signal(&w->cond)); return; } @@ -423,7 +421,7 @@ if (w == NULL) continue; AZ(w->wrq); - assert(1 == write(w->pipe[1], w, 1)); + AZ(pthread_cond_signal(&w->cond)); } } } From des at projects.linpro.no Sun Mar 16 14:11:26 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 16 Mar 2008 15:11:26 +0100 (CET) Subject: r2606 - trunk/varnish-cache/bin/varnishd Message-ID: <20080316141126.65F8C1EC0E6@projects.linpro.no> Author: des Date: 2008-03-16 15:11:26 +0100 (Sun, 16 Mar 2008) New Revision: 2606 Modified: trunk/varnish-cache/bin/varnishd/cache.h Log: The value of HTTP_HDR_MAX is not visible to the preprocessor, so (IOV_MAX < (HTTP_HDR_MAX * 2)) is equivalent to (IOV_MAX < (0 * 2)), which obviously is never true. Fixes #222. Submitted by: Jyri J. Virkki Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-03-13 12:49:36 UTC (rev 2605) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-03-16 14:11:26 UTC (rev 2606) @@ -38,6 +38,7 @@ #include #endif #include +#include #include "vqueue.h" @@ -50,6 +51,8 @@ #include "heritage.h" #include "miniobj.h" +#define HTTP_HDR_MAX_VAL 32 + enum { /* Fields from the first line of HTTP proto */ HTTP_HDR_REQ, @@ -59,14 +62,14 @@ HTTP_HDR_RESPONSE, /* HTTP header lines */ HTTP_HDR_FIRST, - HTTP_HDR_MAX = 32 /* XXX: should be #defined */ + HTTP_HDR_MAX = HTTP_HDR_MAX_VAL }; /* Note: intentionally not IOV_MAX unless it has to be */ -#if (IOV_MAX < (HTTP_HDR_MAX * 2)) +#if (IOV_MAX < (HTTP_HDR_MAX_VAL * 2)) # define MAX_IOVS IOV_MAX #else -# define MAX_IOVS (HTTP_HDR_MAX * 2) +# define MAX_IOVS (HTTP_HDR_MAX_VAL * 2) #endif struct cli; From des at projects.linpro.no Wed Mar 19 12:27:43 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Wed, 19 Mar 2008 13:27:43 +0100 (CET) Subject: r2607 - trunk/varnish-cache/lib/libvcl Message-ID: <20080319122743.9F2F91EC0D7@projects.linpro.no> Author: des Date: 2008-03-19 13:27:43 +0100 (Wed, 19 Mar 2008) New Revision: 2607 Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c Log: s/remove/unset/, but keep remove as an alias for backward compat. Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_action.c 2008-03-16 14:11:26 UTC (rev 2606) +++ trunk/varnish-cache/lib/libvcl/vcc_action.c 2008-03-19 12:27:43 UTC (rev 2607) @@ -276,7 +276,7 @@ /*--------------------------------------------------------------------*/ static void -parse_remove(struct tokenlist *tl) +parse_unset(struct tokenlist *tl) { struct var *vp; @@ -286,7 +286,7 @@ ERRCHK(tl); assert(vp != NULL); if (vp->fmt != STRING || vp->hdr == NULL) { - vsb_printf(tl->sb, "Only http header lines can be removed.\n"); + vsb_printf(tl->sb, "Only http header lines can be unset.\n"); vcc_ErrWhere(tl, tl->t); return; } @@ -367,7 +367,8 @@ #undef VCL_RET_MAC_E { "call", parse_call }, { "set", parse_set }, - { "remove", parse_remove }, + { "unset", parse_unset }, + { "remove", parse_unset }, /* backward compatibility */ { "purge_url", parse_purge_url }, { "purge_hash", parse_purge_hash }, { "esi", parse_esi }, From kobold at projects.linpro.no Mon Mar 24 07:32:13 2008 From: kobold at projects.linpro.no (kobold at projects.linpro.no) Date: Mon, 24 Mar 2008 08:32:13 +0100 (CET) Subject: r2608 - trunk/varnish-cache/debian Message-ID: <20080324073213.4F3651EC0DF@projects.linpro.no> Author: kobold Date: 2008-03-24 08:32:12 +0100 (Mon, 24 Mar 2008) New Revision: 2608 Modified: trunk/varnish-cache/debian/changelog trunk/varnish-cache/debian/rules trunk/varnish-cache/debian/varnish.dirs Log: small fixes to the debian packaging: removed a lintian warning, merged two changelog entries, cleaned debian/rules. Modified: trunk/varnish-cache/debian/changelog =================================================================== --- trunk/varnish-cache/debian/changelog 2008-03-19 12:27:43 UTC (rev 2607) +++ trunk/varnish-cache/debian/changelog 2008-03-24 07:32:12 UTC (rev 2608) @@ -1,17 +1,18 @@ varnish (1.2-0) unstable; urgency=low - * New upstream release + [ Stig Sandbeck Mathisen ] + * New upstream release. + * Check if varnishlog is running before attempting reload from + logrotate postscript. (Closes: #462029) - -- Stig Sandbeck Mathisen Mon, 10 Mar 2008 06:58:19 +0100 + [ Fabio Tranchitella ] + * debian/varnish.dirs: removed unused lintian overrides dir. + * debian/rules: backup and restore of config.sub and config.guess to not + include them into the diff.gz in case of multiple builds from the same + working directory. -varnish (1.1.2-1) unstable; urgency=low + -- Fabio Tranchitella Mon, 24 Mar 2008 08:30:02 +0100 - * Add debian revision - * Check if varnishlog is running before attempting reload from - logrotate postscript (Closes: #462029) - - -- Stig Sandbeck Mathisen Tue, 22 Jan 2008 09:35:05 +0100 - varnish (1.1.2) unstable; urgency=low * New upstream release Modified: trunk/varnish-cache/debian/rules =================================================================== --- trunk/varnish-cache/debian/rules 2008-03-19 12:27:43 UTC (rev 2607) +++ trunk/varnish-cache/debian/rules 2008-03-24 07:32:12 UTC (rev 2608) @@ -32,32 +32,31 @@ # The boilerplate linker flags won't allow varnish to compile :( # There are circular dependencies in the varnish libraries, but # the core developers have OK'ed that we don't check. - ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" --localstatedir=/var/lib + [ -r /usr/share/misc/config.sub ] && \ + cp -f /usr/share/misc/config.sub config.sub || true + [ -r /usr/share/misc/config.guess ] && \ + cp -f /usr/share/misc/config.guess config.guess || true + ./configure \ + --host=$(DEB_HOST_GNU_TYPE) \ + --build=$(DEB_BUILD_GNU_TYPE) \ + --prefix=/usr \ + --mandir=\$${prefix}/share/man \ + --infodir=\$${prefix}/share/info \ + CFLAGS="$(CFLAGS)" --localstatedir=/var/lib - build: build-stamp build-stamp: config.status dh_testdir - $(MAKE) - touch $@ clean: dh_testdir dh_testroot rm -f build-stamp - - [ ! -f Makefile ] || $(MAKE) distclean -ifneq "$(wildcard /usr/share/misc/config.sub)" "" - cp -f /usr/share/misc/config.sub config.sub -endif -ifneq "$(wildcard /usr/share/misc/config.guess)" "" - cp -f /usr/share/misc/config.guess config.guess -endif - - + [ -f config.sub.orig ] && mv config.sub.orig config.sub || true + [ -f config.guess.orig ] && mv config.sub.orig config.guess || true dh_clean install: build @@ -65,14 +64,11 @@ dh_testroot dh_clean -k dh_installdirs - $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp dh_install --sourcedir=$(CURDIR)/debian/tmp - install -m 644 $(CURDIR)/etc/default.vcl $(CURDIR)/debian/varnish/etc/varnish/ install -m 644 $(CURDIR)/debian/varnish.logrotate $(CURDIR)/debian/varnish/etc/logrotate.d/varnish - # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. Modified: trunk/varnish-cache/debian/varnish.dirs =================================================================== --- trunk/varnish-cache/debian/varnish.dirs 2008-03-19 12:27:43 UTC (rev 2607) +++ trunk/varnish-cache/debian/varnish.dirs 2008-03-24 07:32:12 UTC (rev 2608) @@ -5,4 +5,3 @@ var/log var/log/varnish var/lib/varnish -usr/share/lintian/overrides/ From phk at projects.linpro.no Mon Mar 24 08:45:54 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 24 Mar 2008 09:45:54 +0100 (CET) Subject: r2609 - trunk/varnish-cache/bin/varnishd Message-ID: <20080324084554.504011EC0D9@projects.linpro.no> Author: phk Date: 2008-03-24 09:45:54 +0100 (Mon, 24 Mar 2008) New Revision: 2609 Modified: trunk/varnish-cache/bin/varnishd/cache_http.c Log: If the backend does not transmit a respose string, use the default string for the status code as found in RFC2616. Modified: trunk/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_http.c 2008-03-24 07:32:12 UTC (rev 2608) +++ trunk/varnish-cache/bin/varnishd/cache_http.c 2008-03-24 08:45:54 UTC (rev 2609) @@ -451,6 +451,9 @@ if (vctyp(*p, C_CTL)) return (400); hp->hd[h3].e = p; + } else { + hp->hd[h3].b = p; + hp->hd[h3].e = p; } /* Skip CRLF */ @@ -520,6 +523,13 @@ hp->status = strtoul(hp->hd[HTTP_HDR_STATUS].b, NULL /* XXX */, 10); } + if (!Tlen(hp->hd[HTTP_HDR_RESPONSE])) { + /* Backend didn't send a response string, use the standard */ + hp->hd[HTTP_HDR_RESPONSE].b = + TRUST_ME(http_StatusMessage(hp->status)); + hp->hd[HTTP_HDR_RESPONSE].e = + strchr(hp->hd[HTTP_HDR_RESPONSE].b, '\0'); + } return (i); } From ssm at projects.linpro.no Tue Mar 25 05:47:56 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Tue, 25 Mar 2008 06:47:56 +0100 (CET) Subject: r2610 - in branches/1.2: . debian Message-ID: <20080325054756.102FD1EC0B4@projects.linpro.no> Author: ssm Date: 2008-03-25 06:47:55 +0100 (Tue, 25 Mar 2008) New Revision: 2610 Modified: branches/1.2/ branches/1.2/debian/changelog branches/1.2/debian/rules branches/1.2/debian/varnish.dirs Log: Merged revisions 2608 via svnmerge from svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache ........ r2608 | kobold | 2008-03-24 08:32:12 +0100 (Mon, 24 Mar 2008) | 3 lines small fixes to the debian packaging: removed a lintian warning, merged two changelog entries, cleaned debian/rules. ........ Property changes on: branches/1.2 ___________________________________________________________________ Name: svnmerge-integrated - /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2288-2291,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317-2319,2321-2327,2329-2330,2337,2357-2359,2361-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2520-2524,2545,2563-2579,2581-2583,2586,2588,2600 + /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2288-2291,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317-2319,2321-2327,2329-2330,2337,2357-2359,2361-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2520-2524,2545,2563-2579,2581-2583,2586,2588,2600,2608 Modified: branches/1.2/debian/changelog =================================================================== --- branches/1.2/debian/changelog 2008-03-24 08:45:54 UTC (rev 2609) +++ branches/1.2/debian/changelog 2008-03-25 05:47:55 UTC (rev 2610) @@ -1,17 +1,18 @@ varnish (1.2-0) unstable; urgency=low - * New upstream release + [ Stig Sandbeck Mathisen ] + * New upstream release. + * Check if varnishlog is running before attempting reload from + logrotate postscript. (Closes: #462029) - -- Stig Sandbeck Mathisen Mon, 10 Mar 2008 06:58:19 +0100 + [ Fabio Tranchitella ] + * debian/varnish.dirs: removed unused lintian overrides dir. + * debian/rules: backup and restore of config.sub and config.guess to not + include them into the diff.gz in case of multiple builds from the same + working directory. -varnish (1.1.2-1) unstable; urgency=low + -- Fabio Tranchitella Mon, 24 Mar 2008 08:30:02 +0100 - * Add debian revision - * Check if varnishlog is running before attempting reload from - logrotate postscript (Closes: #462029) - - -- Stig Sandbeck Mathisen Tue, 22 Jan 2008 09:35:05 +0100 - varnish (1.1.2) unstable; urgency=low * New upstream release Modified: branches/1.2/debian/rules =================================================================== --- branches/1.2/debian/rules 2008-03-24 08:45:54 UTC (rev 2609) +++ branches/1.2/debian/rules 2008-03-25 05:47:55 UTC (rev 2610) @@ -32,32 +32,31 @@ # The boilerplate linker flags won't allow varnish to compile :( # There are circular dependencies in the varnish libraries, but # the core developers have OK'ed that we don't check. - ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" --localstatedir=/var/lib + [ -r /usr/share/misc/config.sub ] && \ + cp -f /usr/share/misc/config.sub config.sub || true + [ -r /usr/share/misc/config.guess ] && \ + cp -f /usr/share/misc/config.guess config.guess || true + ./configure \ + --host=$(DEB_HOST_GNU_TYPE) \ + --build=$(DEB_BUILD_GNU_TYPE) \ + --prefix=/usr \ + --mandir=\$${prefix}/share/man \ + --infodir=\$${prefix}/share/info \ + CFLAGS="$(CFLAGS)" --localstatedir=/var/lib - build: build-stamp build-stamp: config.status dh_testdir - $(MAKE) - touch $@ clean: dh_testdir dh_testroot rm -f build-stamp - - [ ! -f Makefile ] || $(MAKE) distclean -ifneq "$(wildcard /usr/share/misc/config.sub)" "" - cp -f /usr/share/misc/config.sub config.sub -endif -ifneq "$(wildcard /usr/share/misc/config.guess)" "" - cp -f /usr/share/misc/config.guess config.guess -endif - - + [ -f config.sub.orig ] && mv config.sub.orig config.sub || true + [ -f config.guess.orig ] && mv config.sub.orig config.guess || true dh_clean install: build @@ -65,14 +64,11 @@ dh_testroot dh_clean -k dh_installdirs - $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp dh_install --sourcedir=$(CURDIR)/debian/tmp - install -m 644 $(CURDIR)/etc/default.vcl $(CURDIR)/debian/varnish/etc/varnish/ install -m 644 $(CURDIR)/debian/varnish.logrotate $(CURDIR)/debian/varnish/etc/logrotate.d/varnish - # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. Modified: branches/1.2/debian/varnish.dirs =================================================================== --- branches/1.2/debian/varnish.dirs 2008-03-24 08:45:54 UTC (rev 2609) +++ branches/1.2/debian/varnish.dirs 2008-03-25 05:47:55 UTC (rev 2610) @@ -5,4 +5,3 @@ var/log var/log/varnish var/lib/varnish -usr/share/lintian/overrides/ From phk at projects.linpro.no Mon Mar 31 07:03:03 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 31 Mar 2008 09:03:03 +0200 (CEST) Subject: r2611 - trunk/varnish-cache/bin/varnishd Message-ID: <20080331070303.5CD821EC0B3@projects.linpro.no> Author: phk Date: 2008-03-31 09:03:02 +0200 (Mon, 31 Mar 2008) New Revision: 2611 Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c Log: I'm amazed that we have been able to spell "Authorization" as "Authentication" for this long without anybody noticing until now. Mea Culpa. Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2008-03-25 05:47:55 UTC (rev 2610) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2008-03-31 07:03:02 UTC (rev 2611) @@ -97,7 +97,7 @@ " /* We only deal with GET and HEAD by default */\n" " pass;\n" " }\n" - " if (req.http.Authenticate || req.http.Cookie) {\n" + " if (req.http.Authorization || req.http.Cookie) {\n" " /* Not cacheable by default */\n" " pass;\n" " }\n" From phk at projects.linpro.no Mon Mar 31 11:43:48 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 31 Mar 2008 13:43:48 +0200 (CEST) Subject: r2612 - trunk/varnish-cache/bin/varnishd Message-ID: <20080331114348.9C84A1EC0D9@projects.linpro.no> Author: phk Date: 2008-03-31 13:43:48 +0200 (Mon, 31 Mar 2008) New Revision: 2612 Modified: trunk/varnish-cache/bin/varnishd/flint.lnt Log: Explain to FlexeLint that vsb_new()/vsb_delete() are alloc/free functions. Modified: trunk/varnish-cache/bin/varnishd/flint.lnt =================================================================== --- trunk/varnish-cache/bin/varnishd/flint.lnt 2008-03-31 07:03:02 UTC (rev 2611) +++ trunk/varnish-cache/bin/varnishd/flint.lnt 2008-03-31 11:43:48 UTC (rev 2612) @@ -14,6 +14,8 @@ // Fix strchr() semtics, it can only return NULL if arg2 != 0 -sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 )) +-sem(vsb_new, @p == malloc(1)) +-sem(vsb_delete, custodial(1)) -sem(lbv_assert, r_no) -sem(lbv_xxxassert, r_no) -sem(WS_Init, custodial(2)) From phk at projects.linpro.no Mon Mar 31 11:47:16 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 31 Mar 2008 13:47:16 +0200 (CEST) Subject: r2613 - trunk/varnish-cache/bin/varnishd Message-ID: <20080331114716.14C701EC0B3@projects.linpro.no> Author: phk Date: 2008-03-31 13:47:15 +0200 (Mon, 31 Mar 2008) New Revision: 2613 Modified: trunk/varnish-cache/bin/varnishd/cache_vary.c trunk/varnish-cache/bin/varnishd/mgt_vcc.c Log: Fix three memory leaks related to vsb's not being vsb_deleted: Two really bad ones in Vary processing, found by Arjan (noosius). One isignificant one related to -b arguments being wrong, found by FlexeLint after I taught it how to spot this kind of issue. Modified: trunk/varnish-cache/bin/varnishd/cache_vary.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vary.c 2008-03-31 11:43:48 UTC (rev 2612) +++ trunk/varnish-cache/bin/varnishd/cache_vary.c 2008-03-31 11:47:15 UTC (rev 2613) @@ -69,6 +69,10 @@ struct vsb *sb, *sbh; unsigned l; + /* No Vary: header, no worries */ + if (!http_GetHdr(sp->obj->http, H_Vary, &v)) + return; + /* For vary matching string */ sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); AN(sb); @@ -77,10 +81,6 @@ sbh = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); AN(sbh); - /* No Vary: header, no worries */ - if (!http_GetHdr(sp->obj->http, H_Vary, &v)) - return; - for (p = v; *p; p++) { /* Find next header-name */ @@ -130,6 +130,9 @@ sp->obj->vary = malloc(l); AN(sp->obj->vary); memcpy(sp->obj->vary, vsb_data(sb), l); + + vsb_delete(sb); + vsb_delete(sbh); } int Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2008-03-31 11:43:48 UTC (rev 2612) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2008-03-31 11:47:15 UTC (rev 2613) @@ -423,6 +423,7 @@ */ free(port); fprintf(stderr, "invalid backend address\n"); + vsb_delete(sb); return (1); } From phk at projects.linpro.no Mon Mar 31 11:49:21 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 31 Mar 2008 13:49:21 +0200 (CEST) Subject: r2614 - trunk/varnish-cache/bin/varnishd Message-ID: <20080331114921.12EA01EC0D9@projects.linpro.no> Author: phk Date: 2008-03-31 13:49:20 +0200 (Mon, 31 Mar 2008) New Revision: 2614 Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c Log: Fix a memoryleak relating to hash strings, found by: Arjan (noosius). Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_hash.c 2008-03-31 11:47:15 UTC (rev 2613) +++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2008-03-31 11:49:20 UTC (rev 2614) @@ -383,6 +383,7 @@ assert(VTAILQ_EMPTY(&oh->objects)); MTX_DESTROY(&oh->mtx); VSL_stats->n_objecthead--; + free(oh->hash); FREE_OBJ(oh); } From phk at projects.linpro.no Mon Mar 31 21:48:17 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 31 Mar 2008 23:48:17 +0200 (CEST) Subject: r2615 - trunk/varnish-cache/bin/varnishd Message-ID: <20080331214817.4BCDC1EC0B3@projects.linpro.no> Author: phk Date: 2008-03-31 23:48:16 +0200 (Mon, 31 Mar 2008) New Revision: 2615 Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c Log: spelling fixes Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c 2008-03-31 11:49:20 UTC (rev 2614) +++ trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c 2008-03-31 21:48:16 UTC (rev 2615) @@ -531,7 +531,7 @@ "ESI 1.0 closing esi:comment illegal"); } else if (q[-1] != '/') { esi_error(ew, p, 1 + q - p, - "ESI 1.0 wants emtpy esi:comment"); + "ESI 1.0 wants empty esi:comment"); } p = q + 1; ew->o.b = p; @@ -546,7 +546,7 @@ ew->o.b = r + 11; if (q[-1] != '/') { esi_error(ew, p, 1 + q - p, - "ESI 1.0 wants emtpy esi:include"); + "ESI 1.0 wants empty esi:include"); ew->o.e = q; } else { ew->o.e = q - 1; From phk at projects.linpro.no Mon Mar 31 21:48:33 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 31 Mar 2008 23:48:33 +0200 (CEST) Subject: r2616 - trunk/varnish-cache/bin/varnishd Message-ID: <20080331214833.EB5261EC0D9@projects.linpro.no> Author: phk Date: 2008-03-31 23:48:33 +0200 (Mon, 31 Mar 2008) New Revision: 2616 Modified: trunk/varnish-cache/bin/varnishd/cache_center.c Log: Fix ESI documents with multiple includes. Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2008-03-31 21:48:16 UTC (rev 2615) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2008-03-31 21:48:33 UTC (rev 2616) @@ -169,6 +169,12 @@ INCOMPL(); } + sp->director = NULL; + sp->backend = NULL; /* + * XXX: we may want to leave this + * behind to hint directors ? + */ + RES_WriteObj(sp); HSH_Deref(sp->obj); sp->obj = NULL; @@ -204,7 +210,7 @@ * behind to hint directors ? */ - if (sp->vcl != NULL) { + if (sp->vcl != NULL && sp->esis == 0) { if (sp->wrk->vcl != NULL) VCL_Rel(&sp->wrk->vcl); sp->wrk->vcl = sp->vcl; @@ -774,6 +780,11 @@ CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC); AZ(sp->obj); + /* By default we use the first backend */ + AZ(sp->director); + sp->director = sp->vcl->director[0]; + CHECK_OBJ_NOTNULL(sp->director, DIRECTOR_MAGIC); + VCL_recv_method(sp); sp->wantbody = (strcmp(sp->http->hd[HTTP_HDR_REQ].b, "HEAD") != 0); @@ -854,11 +865,6 @@ sp->doclose = http_DoConnection(sp->http); - /* By default we use the first backend */ - AZ(sp->director); - sp->director = sp->vcl->director[0]; - CHECK_OBJ_NOTNULL(sp->director, DIRECTOR_MAGIC); - /* XXX: Handle TRACE & OPTIONS of Max-Forwards = 0 */ sp->step = STP_RECV; From phk at projects.linpro.no Mon Mar 31 22:07:15 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 1 Apr 2008 00:07:15 +0200 (CEST) Subject: r2617 - trunk/varnish-cache/bin/varnishd Message-ID: <20080331220715.423BB1EC0B3@projects.linpro.no> Author: phk Date: 2008-04-01 00:07:15 +0200 (Tue, 01 Apr 2008) New Revision: 2617 Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c Log: Emit an extra CR+NL after the end of chunked encoding. Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c 2008-03-31 21:48:33 UTC (rev 2616) +++ trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c 2008-03-31 22:07:15 UTC (rev 2617) @@ -786,7 +786,7 @@ } if (sp->esis == 0) - WRK_Write(sp->wrk, "0\r\n", -1); + WRK_Write(sp->wrk, "0\r\n\r\n", -1); } /*--------------------------------------------------------------------*/