From anders at fupp.net Fri Feb 1 08:24:29 2008 From: anders at fupp.net (Anders Nordby) Date: Fri, 1 Feb 2008 09:24:29 +0100 Subject: r2356 - in trunk/varnish-cache: bin/varnishd include lib/libvcl In-Reply-To: <20080121130921.427EE1EC2A4@projects.linpro.no> References: <20080121130921.427EE1EC2A4@projects.linpro.no> Message-ID: <20080201082429.GA16887@fupp.net> Hi, On Mon, Jan 21, 2008 at 02:09:21PM +0100, phk at projects.linpro.no wrote: > Off the bat, this affects only the simple backend case, and the > main thrust is a syntax change from a dynamic procedural assignment > style: > > backend b1 { > set backend.host = "fs.freebsd.dk"; > set backend..port = "80"; > } > > to a constant structural definition style: > > backend b1 { > .host = "fs.freebsd.dk"; > .port = "80"; > } Could you please also commit the attached patch to update the man page. Bye, -- Anders. -------------- next part -------------- --- vcl.7.orig 2008-02-01 09:16:58.000000000 +0100 +++ vcl.7 2008-02-01 09:17:40.000000000 +0100 @@ -80,8 +80,8 @@ A backend declaration creates and initializes a named backend object: .Bd -literal -offset 4n backend www { - set backend.host = "www.example.com"; - set backend.port = "http"; + .host = "www.example.com"; + .port = "http"; } .Ed .Pp From anders at fupp.net Fri Feb 1 16:19:58 2008 From: anders at fupp.net (Anders Nordby) Date: Fri, 1 Feb 2008 17:19:58 +0100 Subject: r2401 - trunk/varnish-cache/bin/varnishd In-Reply-To: <20080129160554.B730F1EC2B5@projects.linpro.no> References: <20080129160554.B730F1EC2B5@projects.linpro.no> Message-ID: <20080201161958.GA29967@fupp.net> Hi, On Tue, Jan 29, 2008 at 05:05:54PM +0100, phk at projects.linpro.no wrote: > Author: phk > Date: 2008-01-29 17:05:54 +0100 (Tue, 29 Jan 2008) > New Revision: 2401 > > Modified: > trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c > Log: > I am not sure if this is a/the race some users are seeing, or if it > even can have any effect, but this will close it at a cost of one > extra kevent(2) every 100ms timer tick. > > The (perceived) problem is that we have pending kqueue changes we > have not yet told the kernel about, then close a number of expired > FD's which might be instantly be recycled by the accept(2) over in > the other thread before we tell the kernel about the pending changes. > > In that case, the kernel has no way of knowing that our changes > referred to the previous instance of the fd and not the new one. > > The solution is to push the changes to the kernel before servicing > the timer. I tried trunk/2415, and I am still having problems with kqueue: Child said (2, 32794): <fd == kp->ident) not true. >> Child said (2, 32794): << errno = 2 (No such file or directory) >> Cache child died pid=32794 status=0x86 (gdb) bt #0 0x0000000800d08fec in thr_kill () from /lib/libc.so.7 #1 0x0000000800d92c5b in abort () from /lib/libc.so.7 #2 0x000000080066a9df in lbv_assert (func=Variable "func" is not available. ) at assert.c:63 #3 0x00000000004087e3 in vca_kqueue_main (arg=Variable "arg" is not available. ) at cache_acceptor_kqueue.c:220 #4 0x0000000800a90a88 in pthread_getprio () from /lib/libthr.so.3 #5 0x0000000000000000 in ?? () Cannot access memory at address 0x7fffff5fc000 (gdb) frame 3 #3 0x00000000004087e3 in vca_kqueue_main (arg=Variable "arg" is not available. ) at cache_acceptor_kqueue.c:220 220 assert(sp->fd == kp->ident); (gdb) print sp Variable "sp" is not available. (gdb) print *sp Variable "sp" is not available. (gdb) print *kp No symbol "kp" in current context. (gdb) print kp No symbol "kp" in current context. (gdb) quit Bye, -- Anders. From des at linpro.no Sat Feb 2 10:24:07 2008 From: des at linpro.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Sat, 02 Feb 2008 11:24:07 +0100 Subject: r2401 - trunk/varnish-cache/bin/varnishd In-Reply-To: <20080201161958.GA29967@fupp.net> (Anders Nordby's message of "Fri, 1 Feb 2008 17:19:58 +0100") References: <20080129160554.B730F1EC2B5@projects.linpro.no> <20080201161958.GA29967@fupp.net> Message-ID: Anders Nordby writes: > I tried trunk/2415, and I am still having problems with kqueue: > > Child said (2, 32794): < cache_acceptor_kqueue.c line 220: > Condition(sp->fd == kp->ident) not true. >>> OK, as mentioned previously: this is caused by a bug (race condition) somewhere else in the code, but it should be possible to detect it and gracefully recover from it at this point. I will send you a patch that should help in the short run - but in the long run, we still need to figure out the root cause. DES -- Dag-Erling Sm?rgrav Senior Software Developer Linpro AS - www.linpro.no From des at projects.linpro.no Sat Feb 2 10:58:05 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sat, 2 Feb 2008 11:58:05 +0100 (CET) Subject: r2416 - trunk/varnish-cache/bin/varnishd Message-ID: <20080202105805.77C1A1EC475@projects.linpro.no> Author: des Date: 2008-02-02 11:58:05 +0100 (Sat, 02 Feb 2008) New Revision: 2416 Modified: trunk/varnish-cache/bin/varnishd/cache.h Log: Add an ALOCKED() macro which asserts that a mutex is locked. Unfortunately, there is no portable way to do this, so we have to fake it by trying to lock the mutex and assert that it fails. This can be very expensive, so we only do it when built with --enable-diagnostics. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-01-31 11:57:51 UTC (rev 2415) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-02-02 10:58:05 UTC (rev 2416) @@ -657,6 +657,12 @@ } while (0); #endif +#ifdef DIAGNOSTICS +#define ALOCKED(foo) AN(pthread_mutex_trylock(foo)) +#else +#define ALOCKED(foo) (void)(foo) +#endif + /* * A normal pointer difference is signed, but we never want a negative value * so this little tool will make sure we don't get that. From phk at projects.linpro.no Sun Feb 3 15:59:02 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 3 Feb 2008 16:59:02 +0100 (CET) Subject: r2417 - in trunk/varnish-cache: . bin/varnishd Message-ID: <20080203155902.36BF21ECDEC@projects.linpro.no> Author: phk Date: 2008-02-03 16:59:01 +0100 (Sun, 03 Feb 2008) New Revision: 2417 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_pool.c trunk/varnish-cache/bin/varnishd/cache_response.c trunk/varnish-cache/bin/varnishd/heritage.h trunk/varnish-cache/bin/varnishd/mgt_param.c trunk/varnish-cache/configure.ac Log: Look for the new SF_SYNC facility in FreeBSDs sendfile(2), and if we find it, allow its use, but still default to off via sendfile_threshold paramter. SF_SYNC is only available in FreeBSD-current as of a few seconds ago, and is unlikely to appear in any release before FreeBSD-8.0 for intricate reasons of ABI compliance. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-02-02 10:58:05 UTC (rev 2416) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-02-03 15:59:01 UTC (rev 2417) @@ -541,9 +541,9 @@ unsigned WRK_Flush(struct worker *w); unsigned WRK_Write(struct worker *w, const void *ptr, int len); unsigned WRK_WriteH(struct worker *w, const txt *hh, const char *suf); -#ifdef HAVE_SENDFILE +#ifdef SENDFILE_WORKS void WRK_Sendfile(struct worker *w, int fd, off_t off, unsigned len); -#endif /* HAVE_SENDFILE */ +#endif /* SENDFILE_WORKS */ /* cache_session.c [SES] */ void SES_Init(void); Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pool.c 2008-02-02 10:58:05 UTC (rev 2416) +++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2008-02-03 15:59:01 UTC (rev 2417) @@ -34,7 +34,7 @@ #include #include -#ifdef HAVE_SENDFILE +#ifdef SENDFILE_WORKS #if defined(__FreeBSD__) #include #elif defined(__linux__) @@ -42,7 +42,7 @@ #else #error Unknown sendfile() implementation #endif -#endif /* HAVE_SENDFILE */ +#endif /* SENDFILE_WORKS */ #include #include @@ -142,7 +142,7 @@ return (len); } -#ifdef HAVE_SENDFILE +#ifdef SENDFILE_WORKS void WRK_Sendfile(struct worker *w, int fd, off_t off, unsigned len) { @@ -174,7 +174,7 @@ #error Unknown sendfile() implementation #endif } -#endif /* HAVE_SENDFILE */ +#endif /* SENDFILE_WORKS */ /*--------------------------------------------------------------------*/ Modified: trunk/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_response.c 2008-02-02 10:58:05 UTC (rev 2416) +++ trunk/varnish-cache/bin/varnishd/cache_response.c 2008-02-03 15:59:01 UTC (rev 2417) @@ -150,7 +150,7 @@ CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC); u += st->len; sp->wrk->acct.bodybytes += st->len; -#ifdef HAVE_SENDFILE +#ifdef SENDFILE_WORKS /* * XXX: the overhead of setting up sendfile is not * XXX: epsilon and maybe not even delta, so avoid @@ -164,7 +164,7 @@ st->where, st->len); continue; } -#endif /* HAVE_SENDFILE */ +#endif /* SENDFILE_WORKS */ VSL_stats->n_objwrite++; WRK_Write(sp->wrk, st->ptr, st->len); } Modified: trunk/varnish-cache/bin/varnishd/heritage.h =================================================================== --- trunk/varnish-cache/bin/varnishd/heritage.h 2008-02-02 10:58:05 UTC (rev 2416) +++ trunk/varnish-cache/bin/varnishd/heritage.h 2008-02-03 15:59:01 UTC (rev 2417) @@ -98,7 +98,7 @@ /* Fetcher hints */ unsigned fetch_chunksize; -#ifdef HAVE_SENDFILE +#ifdef SENDFILE_WORKS /* Sendfile object minimum size */ unsigned sendfile_threshold; #endif Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-02-02 10:58:05 UTC (rev 2416) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-02-03 15:59:01 UTC (rev 2417) @@ -371,7 +371,7 @@ 4, UINT_MAX / 1024); } -#ifdef HAVE_SENDFILE +#ifdef SENDFILE_WORKS /*--------------------------------------------------------------------*/ static void @@ -381,7 +381,7 @@ (void)par; tweak_generic_uint(cli, &master.sendfile_threshold, arg, 0, UINT_MAX); } -#endif /* HAVE_SENDFILE */ +#endif /* SENDFILE_WORKS */ /*--------------------------------------------------------------------*/ @@ -699,12 +699,12 @@ "above 128kb a dubious idea.", EXPERIMENTAL, "128", "kilobytes" }, -#ifdef HAVE_SENDFILE +#ifdef SENDFILE_WORKS { "sendfile_threshold", tweak_sendfile_threshold, "The minimum size of objects transmitted with sendfile.", EXPERIMENTAL, "-1", "bytes" }, -#endif /* HAVE_SENDFILE */ +#endif /* SENDFILE_WORKS */ { "vcl_trace", tweak_vcl_trace, "Trace VCL execution in the shmlog.\n" "Enabling this will allow you to see the path each " Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2008-02-02 10:58:05 UTC (rev 2416) +++ trunk/varnish-cache/configure.ac 2008-02-03 15:59:01 UTC (rev 2417) @@ -103,18 +103,30 @@ AC_CHECK_FUNCS([fmtcheck]) AC_CHECK_FUNCS([getdtablesize]) -# 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 +case $host in +*-*-freebsd*) + AC_CACHE_CHECK([whether sendfile works], + [ac_cv_so_sendfile_works], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[ + #include + #include + #include + ]],[[ + return (SF_SYNC == 0); + ]])], + [ac_cv_so_sendfile_works=yes], + [ac_cv_so_sendfile_works=no]) + ]) + if test "$ac_cv_so_sendfile_works" = yes; then + AC_DEFINE([SENDFILE_WORKS], [1], [Define if SENDFILE works]) + fi + ;; +*) + AC_MSG_WARN([won't look for sendfile() on $host]) + ;; +esac # These functions are provided by libcompat on platforms where they # are not available From des at projects.linpro.no Sun Feb 3 22:26:26 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 3 Feb 2008 23:26:26 +0100 (CET) Subject: r2418 - trunk/varnish-cache/bin/varnishd Message-ID: <20080203222626.1E0DE1EC412@projects.linpro.no> Author: des Date: 2008-02-03 23:26:25 +0100 (Sun, 03 Feb 2008) New Revision: 2418 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_main.c Log: Centralize include, and use pthread_mutex_islocked_np() for ALOCKED() if available. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-02-03 15:59:01 UTC (rev 2417) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-02-03 22:26:25 UTC (rev 2418) @@ -34,6 +34,9 @@ #include #include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif #include #include "vqueue.h" @@ -657,10 +660,12 @@ } while (0); #endif -#ifdef DIAGNOSTICS -#define ALOCKED(foo) AN(pthread_mutex_trylock(foo)) +#if defined(HAVE_PTHREAD_MUTEX_ISLOCKED_NP) +#define ALOCKED(mutex) AN(pthread_mutex_islocked_np((mutex))) +#elif defined(DIAGNOSTICS) +#define ALOCKED(mutex) AN(pthread_mutex_trylock((mutex))) #else -#define ALOCKED(foo) (void)(foo) +#define ALOCKED(mutex) (void)(mutex) #endif /* Modified: trunk/varnish-cache/bin/varnishd/cache_main.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_main.c 2008-02-03 15:59:01 UTC (rev 2417) +++ trunk/varnish-cache/bin/varnishd/cache_main.c 2008-02-03 22:26:25 UTC (rev 2418) @@ -43,10 +43,6 @@ * Name threads if our pthreads implementation supports it. */ -#ifdef HAVE_PTHREAD_NP_H -#include -#endif - void THR_Name(const char *name) { From des at projects.linpro.no Sun Feb 3 22:27:15 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 3 Feb 2008 23:27:15 +0100 (CET) Subject: r2419 - trunk/varnish-cache Message-ID: <20080203222715.C41EB1ECDEC@projects.linpro.no> Author: des Date: 2008-02-03 23:27:15 +0100 (Sun, 03 Feb 2008) New Revision: 2419 Modified: trunk/varnish-cache/configure.ac Log: Clean up checks for non-portable pthread extensions, and add a check for pthread_mutex_islocked_np() (not present on any platform I know of, but I am testing a FreeBSD patch) Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2008-02-03 22:26:25 UTC (rev 2418) +++ trunk/varnish-cache/configure.ac 2008-02-03 22:27:15 UTC (rev 2419) @@ -52,8 +52,6 @@ LIBS="" AC_SEARCH_LIBS(pthread_create, [thr pthread c_r]) PTHREAD_LIBS="${LIBS}" -# Check for thread naming function -AC_CHECK_FUNCS([pthread_set_name_np]) LIBS="${save_LIBS}" AC_SUBST(PTHREAD_LIBS) @@ -77,11 +75,11 @@ AC_CHECK_HEADERS([sys/statvfs.h]) AC_CHECK_HEADERS([sys/vfs.h]) AC_CHECK_HEADERS([netinet/in.h]) +AC_CHECK_HEADERS([pthread_np.h]) AC_CHECK_HEADERS([stddef.h]) AC_CHECK_HEADERS([stdlib.h]) AC_CHECK_HEADERS([unistd.h]) AC_CHECK_HEADERS([vis.h]) -AC_CHECK_HEADERS([pthread_np.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -103,6 +101,12 @@ AC_CHECK_FUNCS([fmtcheck]) AC_CHECK_FUNCS([getdtablesize]) +save_LIBS="${LIBS}" +LIBS="${PTHREAD_LIBS}" +AC_CHECK_FUNCS([pthread_set_name_np]) +AC_CHECK_FUNCS([pthread_mutex_islocked_np]) +LIBS="${save_LIBS}" + ## This one is tricky, there are multiple versions case $host in *-*-freebsd*) From phk at projects.linpro.no Mon Feb 4 09:26:36 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 4 Feb 2008 10:26:36 +0100 (CET) Subject: r2420 - in trunk/varnish-cache: include lib/libvcl Message-ID: <20080204092636.F03981EC412@projects.linpro.no> Author: phk Date: 2008-02-04 10:26:36 +0100 (Mon, 04 Feb 2008) New Revision: 2420 Modified: trunk/varnish-cache/include/vrt_obj.h trunk/varnish-cache/lib/libvcl/vcc_compile.c trunk/varnish-cache/lib/libvcl/vcc_compile.h 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: GC support code for the old backend specification code. Modified: trunk/varnish-cache/include/vrt_obj.h =================================================================== --- trunk/varnish-cache/include/vrt_obj.h 2008-02-03 22:27:15 UTC (rev 2419) +++ trunk/varnish-cache/include/vrt_obj.h 2008-02-04 09:26:36 UTC (rev 2420) @@ -6,10 +6,6 @@ * Edit vcc_gen_obj.tcl instead */ -void VRT_l_backend_host(struct backend *, const char *); -void VRT_l_backend_port(struct backend *, const char *); -void VRT_l_backend_dnsttl(struct backend *, double); -void VRT_l_backend_set(struct backend *, struct vrt_backend_entry *); struct sockaddr * VRT_r_client_ip(const struct sess *); struct sockaddr * VRT_r_server_ip(struct sess *); const char * VRT_r_req_request(const struct sess *); Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.c 2008-02-03 22:27:15 UTC (rev 2419) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.c 2008-02-04 09:26:36 UTC (rev 2420) @@ -692,15 +692,10 @@ void VCC_InitCompile(const char *default_vcl) { - struct var *v; vcc_default_vcl_b = default_vcl; vcc_default_vcl_e = strchr(default_vcl, '\0'); assert(vcc_default_vcl_e != NULL); vcl_init_tnames(); - for (v = vcc_vars; v->name != NULL; v++) - v->len = strlen(v->name); - for (v = vcc_be_vars; v->name != NULL; v++) - v->len = strlen(v->name); } Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.h =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.h 2008-02-03 22:27:15 UTC (rev 2419) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.h 2008-02-04 09:26:36 UTC (rev 2420) @@ -106,11 +106,8 @@ RTIME, STRING, IP, - HOSTNAME, - PORTNAME, HASH, - HEADER, - SET + HEADER }; enum var_access { @@ -177,7 +174,6 @@ void *TlAlloc(struct tokenlist *tl, unsigned len); /* vcc_obj.c */ -extern struct var vcc_be_vars[]; extern struct var vcc_vars[]; /* vcc_parse.c */ Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-02-03 22:27:15 UTC (rev 2419) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-02-04 09:26:36 UTC (rev 2420) @@ -505,10 +505,6 @@ vsb_cat(sb, " * Edit vcc_gen_obj.tcl instead\n"); vsb_cat(sb, " */\n"); vsb_cat(sb, "\n"); - vsb_cat(sb, "void VRT_l_backend_host(struct backend *, const char *);\n"); - vsb_cat(sb, "void VRT_l_backend_port(struct backend *, const char *);\n"); - vsb_cat(sb, "void VRT_l_backend_dnsttl(struct backend *, double);\n"); - vsb_cat(sb, "void VRT_l_backend_set(struct backend *, struct vrt_backend_entry *);\n"); vsb_cat(sb, "struct sockaddr * VRT_r_client_ip(const struct sess *);\n"); vsb_cat(sb, "struct sockaddr * VRT_r_server_ip(struct sess *);\n"); vsb_cat(sb, "const char * VRT_r_req_request(const struct sess *);\n"); @@ -521,8 +517,8 @@ vsb_cat(sb, "struct backend * VRT_r_req_backend(struct sess *);\n"); vsb_cat(sb, "void VRT_l_req_backend(struct sess *, struct backend *);\n"); vsb_cat(sb, "int VRT_r_req_restarts(const struct sess *);\n"); - vsb_cat(sb, "double VRT_r_req_grace(const struct sess *);\n"); - vsb_cat(sb, "void VRT_l_req_grace(const struct sess *, double);\n"); + vsb_cat(sb, "double VRT_r_req_grace(struct sess *);\n"); + vsb_cat(sb, "void VRT_l_req_grace(struct sess *, double);\n"); vsb_cat(sb, "const char * VRT_r_bereq_request(const struct sess *);\n"); vsb_cat(sb, "void VRT_l_bereq_request(const struct sess *, const char *, ...);\n"); vsb_cat(sb, "const char * VRT_r_bereq_url(const struct sess *);\n"); Modified: trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl 2008-02-03 22:27:15 UTC (rev 2419) +++ trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl 2008-02-04 09:26:36 UTC (rev 2420) @@ -30,13 +30,6 @@ # Generate various .c and .h files for the VCL compiler and the interfaces # for it. -# Objects available in backends -set beobj { - { backend.host WO HOSTNAME {} "struct backend *"} - { backend.port WO PORTNAME {} "struct backend *"} - { backend.dnsttl WO TIME {} "struct backend *"} - { backend.set WO SET {} "struct backend *"} -} # Variables available in sessions # Comments are stripped from #...\n @@ -316,12 +309,6 @@ puts $fo "#include \"vcc_compile.h\"" puts $fo "" -puts $fo "struct var vcc_be_vars\[\] = {" -vars $beobj "backend" -puts $fo "};" - -puts $fo "" - puts $fo "struct var vcc_vars\[\] = {" vars $spobj "sp" puts $fo "};" Modified: trunk/varnish-cache/lib/libvcl/vcc_obj.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_obj.c 2008-02-03 22:27:15 UTC (rev 2419) +++ trunk/varnish-cache/lib/libvcl/vcc_obj.c 2008-02-04 09:26:36 UTC (rev 2420) @@ -9,38 +9,6 @@ #include #include "vcc_compile.h" -struct var vcc_be_vars[] = { - { "backend.host", HOSTNAME, 12, - NULL, - "VRT_l_backend_host(backend, ", - V_WO, - 0, - 0 - }, - { "backend.port", PORTNAME, 12, - NULL, - "VRT_l_backend_port(backend, ", - V_WO, - 0, - 0 - }, - { "backend.dnsttl", TIME, 14, - NULL, - "VRT_l_backend_dnsttl(backend, ", - V_WO, - 0, - 0 - }, - { "backend.set", SET, 11, - NULL, - "VRT_l_backend_set(backend, ", - V_WO, - 0, - 0 - }, - { NULL } -}; - struct var vcc_vars[] = { { "client.ip", IP, 9, "VRT_r_client_ip(sp)", From ssm at projects.linpro.no Mon Feb 4 09:32:24 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Mon, 4 Feb 2008 10:32:24 +0100 (CET) Subject: r2421 - trunk/varnish-cache/man Message-ID: <20080204093224.7FD671ECED1@projects.linpro.no> Author: ssm Date: 2008-02-04 10:32:23 +0100 (Mon, 04 Feb 2008) New Revision: 2421 Modified: trunk/varnish-cache/man/vcl.7 Log: Add documentation for req.hash Modified: trunk/varnish-cache/man/vcl.7 =================================================================== --- trunk/varnish-cache/man/vcl.7 2008-02-04 09:26:36 UTC (rev 2420) +++ trunk/varnish-cache/man/vcl.7 2008-02-04 09:32:23 UTC (rev 2421) @@ -445,6 +445,13 @@ seconds. .El .Pp +The following variables are available while determining the hash key +of an object: +.Bl -tag -width 4n +.It Va req.hash +The hash key used to store or fetched an object in the cache. +.El +.Pp The following variables are available while preparing a response to the client: .Bl -tag -width 4n From ssm at projects.linpro.no Mon Feb 4 09:35:53 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Mon, 4 Feb 2008 10:35:53 +0100 (CET) Subject: r2422 - trunk/varnish-cache/man Message-ID: <20080204093553.81A0E1EC412@projects.linpro.no> Author: ssm Date: 2008-02-04 10:35:53 +0100 (Mon, 04 Feb 2008) New Revision: 2422 Modified: trunk/varnish-cache/man/vcl.7 Log: Typo patrol Modified: trunk/varnish-cache/man/vcl.7 =================================================================== --- trunk/varnish-cache/man/vcl.7 2008-02-04 09:32:23 UTC (rev 2421) +++ trunk/varnish-cache/man/vcl.7 2008-02-04 09:35:53 UTC (rev 2422) @@ -449,7 +449,8 @@ of an object: .Bl -tag -width 4n .It Va req.hash -The hash key used to store or fetched an object in the cache. +The hash key used to refer to an object in the cache. Used when both +reading from and writing to the cache. .El .Pp The following variables are available while preparing a response to From phk at projects.linpro.no Mon Feb 4 09:51:23 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 4 Feb 2008 10:51:23 +0100 (CET) Subject: r2423 - in trunk/varnish-cache: bin/varnishd include lib/libvcl Message-ID: <20080204095123.B66BC1ECED1@projects.linpro.no> Author: phk Date: 2008-02-04 10:51:23 +0100 (Mon, 04 Feb 2008) New Revision: 2423 Modified: trunk/varnish-cache/bin/varnishd/cache_backend_random.c trunk/varnish-cache/include/vrt.h trunk/varnish-cache/lib/libvcl/vcc_backend.c trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c Log: Complete the VCC part of random directors, runtime code next. Modified: trunk/varnish-cache/bin/varnishd/cache_backend_random.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend_random.c 2008-02-04 09:35:53 UTC (rev 2422) +++ trunk/varnish-cache/bin/varnishd/cache_backend_random.c 2008-02-04 09:51:23 UTC (rev 2423) @@ -437,8 +437,11 @@ /*--------------------------------------------------------------------*/ void -VRT_init_random_backend(struct backend **bp, const struct vrt_random_backend *t) +VRT_init_random_backend(struct backend **bp, const struct vrt_dir_random *t) { + (void)bp; + (void)t; +#if 0 struct backend *b; struct ber *ber; struct vrt_backend_entry *be; @@ -508,5 +511,6 @@ ber->blist = bs; *bp = b; +#endif } Modified: trunk/varnish-cache/include/vrt.h =================================================================== --- trunk/varnish-cache/include/vrt.h 2008-02-04 09:35:53 UTC (rev 2422) +++ trunk/varnish-cache/include/vrt.h 2008-02-04 09:51:23 UTC (rev 2423) @@ -72,7 +72,7 @@ struct vrt_dir_random { unsigned nmember; - struct vrt_dir_random_entry *members; + const struct vrt_dir_random_entry *members; const char *ident; }; @@ -135,7 +135,7 @@ /* Backend related */ void VRT_init_simple_backend(struct backend **, const struct vrt_simple_backend *); void VRT_init_round_robin_backend(struct backend **, const struct vrt_round_robin_backend *); -void VRT_init_random_backend(struct backend **, const struct vrt_random_backend *); +void VRT_init_random_backend(struct backend **, const struct vrt_dir_random *); void VRT_fini_backend(struct backend *); char *VRT_IP_string(const struct sess *sp, const struct sockaddr *sa); Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-02-04 09:35:53 UTC (rev 2422) +++ trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-02-04 09:51:23 UTC (rev 2423) @@ -217,7 +217,6 @@ fs = vcc_FldSpec(tl, "!host", "?port", NULL); t_first = tl->t; - *nbh = tl->nbackend_host++; if (tl->t->tok == ID) { VTAILQ_FOREACH(h, &tl->hosts, list) { @@ -240,8 +239,8 @@ ExpectErr(tl, '{'); vcc_NextToken(tl); - Fh(tl, 0, "\nstatic const struct vrt_backend_host bh_%d = {\n", - *nbh); + *nbh = tl->nbackend_host++; + Fh(tl, 0, "\nstatic const struct vrt_backend_host bh_%d = {\n", *nbh); /* Check for old syntax */ if (tl->t->tok == ID && vcc_IdIs(tl->t, "set")) { @@ -376,6 +375,9 @@ int nbh, nelem; struct fld_spec *fs; + Fh(tl, 1, "\n#define VGC_backend_%.*s (VCL_conf.backend[%d])\n", + PF(t_dir), tl->nbackend); + fs = vcc_FldSpec(tl, "!backend", "?weight", NULL); vcc_NextToken(tl); /* ID: policy (= random) */ @@ -418,14 +420,18 @@ vcc_NextToken(tl); } Fc(tl, 0, "\t{ .host = 0 }\n"); - Fc(tl, 0, "}\n"); + Fc(tl, 0, "};\n"); Fc(tl, 0, - "\nstatic const struct vrt_dir_random vdr_%.*s[] = {\n", + "\nstatic const struct vrt_dir_random vdr_%.*s = {\n", PF(t_dir)); Fc(tl, 0, "\t.nmember = %d,\n", nelem); Fc(tl, 0, "\t.members = vdre_%.*s,\n", PF(t_dir)); vcc_EmitBeIdent(tl->fc, t_first, tl->t); + Fc(tl, 0, "};\n"); vcc_NextToken(tl); + Fi(tl, 0, "\tVRT_init_random_backend(&VGC_backend_%.*s , &vdr_%.*s);\n", + PF(t_dir), PF(t_dir)); + Ff(tl, 0, "\tVRT_fini_random_backend(VGC_backend_%.*s);\n", PF(t_dir)); } /*-------------------------------------------------------------------- Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-02-04 09:35:53 UTC (rev 2422) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-02-04 09:51:23 UTC (rev 2423) @@ -423,7 +423,7 @@ vsb_cat(sb, "\n"); vsb_cat(sb, "struct vrt_dir_random {\n"); vsb_cat(sb, " unsigned nmember;\n"); - vsb_cat(sb, " struct vrt_dir_random_entry *members;\n"); + vsb_cat(sb, " const struct vrt_dir_random_entry *members;\n"); vsb_cat(sb, " const char *ident;\n"); vsb_cat(sb, "};\n"); vsb_cat(sb, "\n"); @@ -486,7 +486,7 @@ vsb_cat(sb, "/* Backend related */\n"); vsb_cat(sb, "void VRT_init_simple_backend(struct backend **, const struct vrt_simple_backend *);\n"); vsb_cat(sb, "void VRT_init_round_robin_backend(struct backend **, const struct vrt_round_robin_backend *);\n"); - vsb_cat(sb, "void VRT_init_random_backend(struct backend **, const struct vrt_random_backend *);\n"); + vsb_cat(sb, "void VRT_init_random_backend(struct backend **, const struct vrt_dir_random *);\n"); vsb_cat(sb, "void VRT_fini_backend(struct backend *);\n"); vsb_cat(sb, "\n"); vsb_cat(sb, "char *VRT_IP_string(const struct sess *sp, const struct sockaddr *sa);\n"); From phk at projects.linpro.no Mon Feb 4 09:55:53 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 4 Feb 2008 10:55:53 +0100 (CET) Subject: r2424 - trunk/varnish-cache/lib/libvcl Message-ID: <20080204095553.C84B31EC412@projects.linpro.no> Author: phk Date: 2008-02-04 10:55:53 +0100 (Mon, 04 Feb 2008) New Revision: 2424 Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c Log: Add X-ref definition of random directors. Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-02-04 09:51:23 UTC (rev 2423) +++ trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-02-04 09:55:53 UTC (rev 2424) @@ -369,7 +369,7 @@ */ static void -vcc_ParseRandomDirector(struct tokenlist *tl, const struct token *t_first, const struct token *t_dir) +vcc_ParseRandomDirector(struct tokenlist *tl, const struct token *t_first, struct token *t_dir) { struct token *t_field; int nbh, nelem; @@ -377,6 +377,7 @@ Fh(tl, 1, "\n#define VGC_backend_%.*s (VCL_conf.backend[%d])\n", PF(t_dir), tl->nbackend); + vcc_AddDef(tl, t_dir, R_BACKEND); fs = vcc_FldSpec(tl, "!backend", "?weight", NULL); From phk at projects.linpro.no Mon Feb 4 09:58:55 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 4 Feb 2008 10:58:55 +0100 (CET) Subject: r2425 - trunk/varnish-cache/lib/libvcl Message-ID: <20080204095855.AA63A1EC412@projects.linpro.no> Author: phk Date: 2008-02-04 10:58:55 +0100 (Mon, 04 Feb 2008) New Revision: 2425 Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c Log: Backend fini functions are methods of the class, call the generic one. Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-02-04 09:55:53 UTC (rev 2424) +++ trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-02-04 09:58:55 UTC (rev 2425) @@ -432,7 +432,7 @@ vcc_NextToken(tl); Fi(tl, 0, "\tVRT_init_random_backend(&VGC_backend_%.*s , &vdr_%.*s);\n", PF(t_dir), PF(t_dir)); - Ff(tl, 0, "\tVRT_fini_random_backend(VGC_backend_%.*s);\n", PF(t_dir)); + Ff(tl, 0, "\tVRT_fini_backend(VGC_backend_%.*s);\n", PF(t_dir)); } /*-------------------------------------------------------------------- From ssm at projects.linpro.no Tue Feb 5 08:26:31 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Tue, 5 Feb 2008 09:26:31 +0100 (CET) Subject: r2426 - in trunk/varnish-tools: . emacs Message-ID: <20080205082631.F3FCB1EC1D1@projects.linpro.no> Author: ssm Date: 2008-02-05 09:26:31 +0100 (Tue, 05 Feb 2008) New Revision: 2426 Added: trunk/varnish-tools/emacs/ trunk/varnish-tools/emacs/vcl-mode.el Log: Add a VCL major mode for emacs Added: trunk/varnish-tools/emacs/vcl-mode.el =================================================================== --- trunk/varnish-tools/emacs/vcl-mode.el (rev 0) +++ trunk/varnish-tools/emacs/vcl-mode.el 2008-02-05 08:26:31 UTC (rev 2426) @@ -0,0 +1,244 @@ +;;; vcl-mode.el - Syntax highlighting for Varnish Command Language +;;; +;;; Copyright (c) 2008 Linpro AS +;;; All rights reserved. +;;; +;;; Author: Stig Sandbeck Mathisen +;;; +;;; Redistribution and use in source and binary forms, with or without +;;; modification, are permitted provided that the following conditions +;;; are met: +;;; 1. Redistributions of source code must retain the above copyright +;;; notice, this list of conditions and the following disclaimer. +;;; 2. Redistributions in binary form must reproduce the above +;;; copyright notice, this list of conditions and the following +;;; disclaimer in the documentation and/or other materials provided +;;; with the distribution. +;;; +;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' +;;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +;;; TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +;;; PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR +;;; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +;;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +;;; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +;;; USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +;;; AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +;;; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +;;; ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +;;; POSSIBILITY OF SUCH DAMAGE. +;;; +;;; $Id$ +;;; + +;; I just love standards, there are so many to choose from +(if (string-match "XEmacs\\|Lucid" emacs-version) + (require 'generic-mode) + (require 'generic)) + +;; Add a VCL major mode called "vcl-mode", based on generic-mode + +(define-generic-mode 'vcl-mode + ;; comments (defined in "vcl-mode-setup-function" + nil + ;; keywords (defined under "others" instead) + nil + ;; others + (list + ;; Logic + (generic-make-keywords-list + (list + "else" + "elsif" + "if" + "remove" + "set" + ) + 'font-lock-keyword-face) + + ;; Types + (generic-make-keywords-list + (list + "purge_url" + "regsub" + ) + 'font-lock-builtin-face) + + ;; VCL Functions + (generic-make-keywords-list + (list + "acl" + "backend" + "sub" + "vcl_deliver" + "vcl_discard" + "vcl_hash" + "vcl_hit" + "vcl_miss" + "vcl_pass" + "vcl_pipe" + "vcl_recv" + "vcl_timeout" + ) + 'font-lock-function-name-face) + + ;; Actions + (generic-make-keywords-list + (list + "deliver" + "discard" + "error" + "fetch" + "hash" + "keep" + "lookup" + "pass" + "pipe" + ) + 'font-lock-function-name-face) + + ;; Variables + (generic-make-keywords-list + (list + "backend.host" + "backend.port" + "bereq.proto" + "bereq.request" + "bereq.url" + "client.ip" + "now" + "obj.cacheable" + "obj.lastuse" + "obj.proto" + "obj.response" + "obj.status" + "obj.ttl" + "obj.valid" + "req.backend" + "req.hash" + "req.proto" + "req.request" + "req.url" + "resp.proto" + "resp.response" + "resp.status" + "server.ip" + ) + 'font-lock-variable-name-face) + + ;; More variables + '("\\(\\(be\\)?req\\|resp\\|obj\\)\.http\.[A-Za-z-]+" . + font-lock-variable-name-face)) + + ;; Filenames to highlight + '("\\.vcl\\'") + (list 'vcl-mode-setup-function) + "Mode for Varnish Command Language") + + +;; A function to modify syntax, add a hook if needed, and setup +;; indentation. + +(defun vcl-mode-setup-function () + ;; These are "part of words" + (modify-syntax-entry ?_ "w") + (modify-syntax-entry ?. "w") + + ;; C++-style comments + (modify-syntax-entry ?/ ". 124b") + (modify-syntax-entry ?* ". 23b") + (modify-syntax-entry ?\n ">b") + + ;; Perl-style comments + (modify-syntax-entry ?# "<") + (modify-syntax-entry ?\n ">") + + (run-hooks 'vcl-mode-hook) + (set (make-local-variable 'indent-line-function) 'vcl-indent-line) + ) + +(defvar vcl-mode-hook nil) + +(defconst vcl-indent-level 2 "The indentation in VCL-mode") + +(defun vcl-indent-line () + "Indent the current VCL line according to syntax." + (interactive) + (indent-line-to + (max (vcl-calculate-indentation) 0))) + + +;; The function to calculate indentation level. This is a really +;; simple and naive function, and does not perform anything like a +;; syntax check. +(defun vcl-calculate-indentation () + "Return the column to which the current line should be indented." + (interactive) + (save-excursion + ; Reduce indent level if we + ; close a block on this line + (if (vcl-closing-tag-on-this-line-p) + (- (vcl-previous-line-indentation) + vcl-indent-level) + ; Increase indent level if a + ; block opened on the previous + ; line + (if (vcl-opening-tag-on-previous-line-p) + (+ (vcl-previous-line-indentation) + vcl-indent-level) + ; Do not indent empty lines + (if (vcl-empty-line-p) + 0 + ; By default, indent to the + ; level of the previous + ; non-empty line + (vcl-previous-line-indentation)))))) + +(defun vcl-opening-tag-on-previous-line-p () + "Checks if we have an opening tag on the previous line." + (interactive) + (save-excursion + (beginning-of-line) + (skip-chars-backward " \t\n") + (beginning-of-line) + (if (and (looking-at ".*{[ \t]*$") + (not (vcl-comment-p))) + t))) + +(defun vcl-closing-tag-on-this-line-p () + "Checks if we have a closing tag on this line." + (interactive) + (save-excursion + (back-to-indentation) + (looking-at "}"))) + +(defun vcl-previous-line-indentation () + "Return the column to which the current line should be indented." + (interactive) + (save-excursion + (beginning-of-line) + (skip-chars-backward " \t\n") + (back-to-indentation) + (current-column))) + +(defun vcl-comment-p () + "Checks if we have a commented line." + (interactive) + (save-excursion + (beginning-of-line) + (looking-at "^[ \t]*#"))) + +(defun vcl-empty-line-p () + "Checks if we have an empty line." + (interactive) + (save-excursion + (beginning-of-line) + (looking-at "^[ \t]*$"))) + +(defun vcl-newline-and-indent () + "Insert a newline, updating indentation." + (interactive) + (save-excursion + (vcl-indent-line)) + (call-interactively 'newline-and-indent)) + Property changes on: trunk/varnish-tools/emacs/vcl-mode.el ___________________________________________________________________ Name: svn:keywords + id From phk at projects.linpro.no Tue Feb 5 09:31:00 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 5 Feb 2008 10:31:00 +0100 (CET) Subject: r2427 - trunk/varnish-cache/bin/varnishd Message-ID: <20080205093100.7FA451ECE1D@projects.linpro.no> Author: phk Date: 2008-02-05 10:31:00 +0100 (Tue, 05 Feb 2008) New Revision: 2427 Modified: trunk/varnish-cache/bin/varnishd/cache_vcl.c Log: cli_out() already has NULL check. Modified: trunk/varnish-cache/bin/varnishd/cache_vcl.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vcl.c 2008-02-05 08:26:31 UTC (rev 2426) +++ trunk/varnish-cache/bin/varnishd/cache_vcl.c 2008-02-05 09:31:00 UTC (rev 2427) @@ -136,10 +136,7 @@ vcl = vcl_find(name); if (vcl != NULL) { - if (cli == NULL) - fprintf(stderr, "Config '%s' already loaded", name); - else - cli_out(cli, "Config '%s' already loaded", name); + cli_out(cli, "Config '%s' already loaded", name); return (1); } @@ -149,29 +146,20 @@ vcl->dlh = dlopen(fn, RTLD_NOW | RTLD_LOCAL); if (vcl->dlh == NULL) { - if (cli == NULL) - fprintf(stderr, "dlopen(%s): %s\n", fn, dlerror()); - else - cli_out(cli, "dlopen(%s): %s\n", fn, dlerror()); + cli_out(cli, "dlopen(%s): %s\n", fn, dlerror()); free(vcl); return (1); } vcl->conf = dlsym(vcl->dlh, "VCL_conf"); if (vcl->conf == NULL) { - if (cli == NULL) - fprintf(stderr, "No VCL_conf symbol\n"); - else - cli_out(cli, "No VCL_conf symbol\n"); + cli_out(cli, "No VCL_conf symbol\n"); (void)dlclose(vcl->dlh); free(vcl); return (1); } if (vcl->conf->magic != VCL_CONF_MAGIC) { - if (cli == NULL) - fprintf(stderr, "Wrong VCL_CONF_MAGIC\n"); - else - cli_out(cli, "Wrong VCL_CONF_MAGIC\n"); + cli_out(cli, "Wrong VCL_CONF_MAGIC\n"); (void)dlclose(vcl->dlh); free(vcl); return (1); @@ -184,10 +172,7 @@ if (vcl_active == NULL) vcl_active = vcl; UNLOCK(&vcl_mtx); - if (cli == NULL) - fprintf(stderr, "Loaded \"%s\" as \"%s\"\n", fn , name); - else - cli_out(cli, "Loaded \"%s\" as \"%s\"\n", fn , name); + cli_out(cli, "Loaded \"%s\" as \"%s\"\n", fn , name); vcl->conf->init_func(); return (0); } From phk at projects.linpro.no Tue Feb 5 09:46:30 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 5 Feb 2008 10:46:30 +0100 (CET) Subject: r2428 - trunk/varnish-cache/bin/varnishd Message-ID: <20080205094630.A2E021EC475@projects.linpro.no> Author: phk Date: 2008-02-05 10:46:30 +0100 (Tue, 05 Feb 2008) New Revision: 2428 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_cli.c Log: We assume that all CLI processing in the child process happens in the same thread (the main thread in fact). Add an assert facility to mark the affected functions, just to make sure nobody (else) gets an anciety attack over missing locking. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-02-05 09:31:00 UTC (rev 2427) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-02-05 09:46:30 UTC (rev 2428) @@ -470,6 +470,8 @@ /* cache_cli.c [CLI] */ void CLI_Init(void); +extern pthread_t cli_thread; +#define ASSERT_CLI() do {assert(phtread_self() == cli_thread);} while (0) /* cache_expiry.c */ void EXP_Insert(struct object *o); Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-02-05 09:31:00 UTC (rev 2427) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-02-05 09:46:30 UTC (rev 2428) @@ -44,6 +44,8 @@ #include "vsb.h" #include "heritage.h" +pthread_t cli_thread; + /*--------------------------------------------------------------------*/ static void @@ -92,6 +94,7 @@ cli = &clis; memset(cli, 0, sizeof *cli); + cli_thread = pthread_self(); cli->sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); XXXAN(cli->sb); lbuf = 4096; From phk at projects.linpro.no Tue Feb 5 09:57:47 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 5 Feb 2008 10:57:47 +0100 (CET) Subject: r2429 - trunk/varnish-cache/bin/varnishd Message-ID: <20080205095747.1AEC51EC412@projects.linpro.no> Author: phk Date: 2008-02-05 10:57:46 +0100 (Tue, 05 Feb 2008) New Revision: 2429 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_backend.c trunk/varnish-cache/bin/varnishd/cache_backend_round_robin.c trunk/varnish-cache/bin/varnishd/cache_backend_simple.c Log: Rename VBE_NewBackend() to VBE_AddBackend() and make it responsible for the identity check for reusing backends between VCL. Disable the round-robin code for now, I'm trying to get the random code working first. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-02-05 09:46:30 UTC (rev 2428) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-02-05 09:57:46 UTC (rev 2429) @@ -408,6 +408,7 @@ pthread_mutex_t mtx; struct backend_method *method; + const char *ident; void *priv; int health; @@ -442,7 +443,7 @@ extern struct backendlist backendlist; void VBE_DropRef(struct backend *); void VBE_DropRefLocked(struct backend *); -struct backend *VBE_NewBackend(struct backend_method *method); +struct backend *VBE_AddBackend(struct backend_method *method, const char *ident); struct vbe_conn *VBE_NewConn(void); void VBE_ReleaseConn(struct vbe_conn *); void VBE_UpdateHealth(const struct sess *sp, const struct vbe_conn *, int); @@ -471,7 +472,7 @@ /* cache_cli.c [CLI] */ void CLI_Init(void); extern pthread_t cli_thread; -#define ASSERT_CLI() do {assert(phtread_self() == cli_thread);} while (0) +#define ASSERT_CLI() do {assert(pthread_self() == cli_thread);} while (0) /* cache_expiry.c */ void EXP_Insert(struct object *o); Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend.c 2008-02-05 09:46:30 UTC (rev 2428) +++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2008-02-05 09:57:46 UTC (rev 2429) @@ -211,28 +211,7 @@ UNLOCK(&VBE_mtx); } -/*--------------------------------------------------------------------*/ -struct backend * -VBE_NewBackend(struct backend_method *method) -{ - struct backend *b; - - b = calloc(sizeof *b, 1); - XXXAN(b); - b->magic = BACKEND_MAGIC; - b->method = method; - - MTX_INIT(&b->mtx); - b->refcount = 1; - - b->last_check = TIM_mono(); - b->minute_limit = 1; - - VTAILQ_INSERT_TAIL(&backendlist, b, list); - return (b); -} - /*--------------------------------------------------------------------*/ void @@ -344,6 +323,46 @@ bem->init(); } +/*-------------------------------------------------------------------- + * Add a backend/director instance when loading a VCL. + * If an existing backend is matched, grab a refcount and return NULL. + * Else create a new backend structure and return that with reference + * initialized to one. + */ + +struct backend * +VBE_AddBackend(struct backend_method *method, const char *ident) +{ + struct backend *b; + + ASSERT_CLI(); + VTAILQ_FOREACH(b, &backendlist, list) { + CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC); + if (b->method != method) + continue; + if (strcmp(b->ident, ident)) + continue; + b->refcount++; + return (NULL); + } + + b = calloc(sizeof *b, 1); + XXXAN(b); + b->magic = BACKEND_MAGIC; + b->method = method; + b->ident = strdup(ident); + XXXAN(b->ident); + + MTX_INIT(&b->mtx); + b->refcount = 1; + + b->last_check = TIM_mono(); + b->minute_limit = 1; + + VTAILQ_INSERT_TAIL(&backendlist, b, list); + return (b); +} + /*--------------------------------------------------------------------*/ void @@ -353,5 +372,7 @@ MTX_INIT(&VBE_mtx); VBE_AddBackendMethod(&backend_method_simple); VBE_AddBackendMethod(&backend_method_random); +#if 0 VBE_AddBackendMethod(&backend_method_round_robin); +#endif } Modified: trunk/varnish-cache/bin/varnishd/cache_backend_round_robin.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend_round_robin.c 2008-02-05 09:46:30 UTC (rev 2428) +++ trunk/varnish-cache/bin/varnishd/cache_backend_round_robin.c 2008-02-05 09:57:46 UTC (rev 2429) @@ -30,6 +30,8 @@ * */ +#if 0 + #include #include @@ -487,3 +489,4 @@ *bp = b; } +#endif Modified: trunk/varnish-cache/bin/varnishd/cache_backend_simple.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend_simple.c 2008-02-05 09:46:30 UTC (rev 2428) +++ trunk/varnish-cache/bin/varnishd/cache_backend_simple.c 2008-02-05 09:57:46 UTC (rev 2429) @@ -364,23 +364,10 @@ struct bes *bes; const char *p; - /* - * Scan existing backends to see if we can recycle one of them. - */ - VTAILQ_FOREACH(b, &backendlist, list) { - CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC); - if (b->method != &backend_method_simple) - continue; - CAST_OBJ_NOTNULL(bes, b->priv, BES_MAGIC); - if (strcmp(bes->ident, t->ident)) - continue; - b->refcount++; - *bp = b; - return; - } + b = VBE_AddBackend(&backend_method_simple, t->ident); + if (b == NULL) + return; /* ref to existing backend */ - b = VBE_NewBackend(&backend_method_simple); - bes = calloc(sizeof *bes, 1); XXXAN(bes); bes->magic = BES_MAGIC; From phk at projects.linpro.no Tue Feb 5 10:50:33 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 5 Feb 2008 11:50:33 +0100 (CET) Subject: r2430 - in trunk/varnish-cache: include lib/libvcl Message-ID: <20080205105033.85C371EC475@projects.linpro.no> Author: phk Date: 2008-02-05 11:50:33 +0100 (Tue, 05 Feb 2008) New Revision: 2430 Modified: trunk/varnish-cache/include/vcl.h trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl Log: Add a discard flag to the VCL_conf. Modified: trunk/varnish-cache/include/vcl.h =================================================================== --- trunk/varnish-cache/include/vcl.h 2008-02-05 09:57:46 UTC (rev 2429) +++ trunk/varnish-cache/include/vcl.h 2008-02-05 10:50:33 UTC (rev 2430) @@ -21,6 +21,7 @@ struct vrt_ref *ref; unsigned nref; unsigned busy; + unsigned discard; unsigned nsrc; const char **srcname; Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-02-05 09:57:46 UTC (rev 2429) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-02-05 10:50:33 UTC (rev 2430) @@ -325,6 +325,7 @@ vsb_cat(sb, " struct vrt_ref *ref;\n"); vsb_cat(sb, " unsigned nref;\n"); vsb_cat(sb, " unsigned busy;\n"); + vsb_cat(sb, " unsigned discard;\n"); vsb_cat(sb, " \n"); vsb_cat(sb, " unsigned nsrc;\n"); vsb_cat(sb, " const char **srcname;\n"); Modified: trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl 2008-02-05 09:57:46 UTC (rev 2429) +++ trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl 2008-02-05 10:50:33 UTC (rev 2430) @@ -137,6 +137,7 @@ struct vrt_ref *ref; unsigned nref; unsigned busy; + unsigned discard; unsigned nsrc; const char **srcname; From phk at projects.linpro.no Tue Feb 5 11:19:22 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 5 Feb 2008 12:19:22 +0100 (CET) Subject: r2431 - trunk/varnish-cache/bin/varnishd Message-ID: <20080205111922.B4C341EC2B2@projects.linpro.no> Author: phk Date: 2008-02-05 12:19:22 +0100 (Tue, 05 Feb 2008) New Revision: 2431 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_backend.c trunk/varnish-cache/bin/varnishd/cache_cli.c trunk/varnish-cache/bin/varnishd/cache_vcl.c trunk/varnish-cache/bin/varnishd/cache_vrt.c Log: Add the missing bits to actually allow discards of VCL code. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-02-05 10:50:33 UTC (rev 2430) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-02-05 11:19:22 UTC (rev 2431) @@ -595,6 +595,7 @@ void VCL_Refresh(struct VCL_conf **vcc); void VCL_Rel(struct VCL_conf **vcc); void VCL_Get(struct VCL_conf **vcc); +void VCL_Idle(void); #define VCL_RET_MAC(l,u,b,n) #define VCL_MET_MAC(l,u,b) void VCL_##l##_method(struct sess *); Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend.c 2008-02-05 10:50:33 UTC (rev 2430) +++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2008-02-05 11:19:22 UTC (rev 2431) @@ -51,7 +51,6 @@ struct backendlist backendlist = VTAILQ_HEAD_INITIALIZER(backendlist); - /*-------------------------------------------------------------------- * Attempt to connect to a given addrinfo entry. * @@ -222,8 +221,10 @@ CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC); i = --b->refcount; - if (i == 0) + if (i == 0) { + ASSERT_CLI(); /* XXX: ?? */ VTAILQ_REMOVE(&backendlist, b, list); + } UNLOCK(&b->mtx); if (i) return; Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-02-05 10:50:33 UTC (rev 2430) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-02-05 11:19:22 UTC (rev 2431) @@ -106,8 +106,10 @@ pfd[0].fd = heritage.fds[2]; pfd[0].events = POLLIN; i = poll(pfd, 1, 5000); - if (i == 0) + if (i == 0) { + VCL_Idle(); continue; + } if ((nbuf + 2) >= lbuf) { lbuf += lbuf; buf = realloc(buf, lbuf); Modified: trunk/varnish-cache/bin/varnishd/cache_vcl.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vcl.c 2008-02-05 10:50:33 UTC (rev 2430) +++ trunk/varnish-cache/bin/varnishd/cache_vcl.c 2008-02-05 11:19:22 UTC (rev 2431) @@ -47,10 +47,9 @@ struct vcls { VTAILQ_ENTRY(vcls) list; - const char *name; + char *name; void *dlh; struct VCL_conf *conf; - int discard; }; /* @@ -61,10 +60,9 @@ VTAILQ_HEAD_INITIALIZER(vcl_head); +static MTX vcl_mtx; static struct vcls *vcl_active; /* protected by vcl_mtx */ -static MTX vcl_mtx; - /*--------------------------------------------------------------------*/ void @@ -85,6 +83,7 @@ AN(vcl_active); *vcc = vcl_active->conf; AN(*vcc); + AZ((*vcc)->discard); (*vcc)->busy++; UNLOCK(&vcl_mtx); } @@ -92,7 +91,6 @@ void VCL_Rel(struct VCL_conf **vcc) { - struct vcls *vcl; struct VCL_conf *vc; vc = *vcc; @@ -101,19 +99,11 @@ LOCK(&vcl_mtx); assert(vc->busy > 0); vc->busy--; - vcl = vc->priv; /* XXX miniobj */ - if (vc->busy == 0 && vcl_active != vcl) { - /* XXX: purge backends */ - } - if (vc->busy == 0 && vcl->discard) { - VTAILQ_REMOVE(&vcl_head, vcl, list); - } else { - vcl = NULL; - } + /* + * We do not garbage collect discarded VCL's here, that happens + * in VCL_Idle() which is called from the CLI thread. + */ UNLOCK(&vcl_mtx); - if (vcl != NULL) { - /* XXX: dispose of vcl */ - } } /*--------------------------------------------------------------------*/ @@ -123,9 +113,13 @@ { struct vcls *vcl; - VTAILQ_FOREACH(vcl, &vcl_head, list) + ASSERT_CLI(); + VTAILQ_FOREACH(vcl, &vcl_head, list) { + if (vcl->conf->discard) + continue; if (!strcmp(vcl->name, name)) return (vcl); + } return (NULL); } @@ -134,6 +128,7 @@ { struct vcls *vcl; + ASSERT_CLI(); vcl = vcl_find(name); if (vcl != NULL) { cli_out(cli, "Config '%s' already loaded", name); @@ -177,15 +172,48 @@ return (0); } +/*-------------------------------------------------------------------- + * This function is polled from the CLI thread to dispose of any non-busy + * VCLs * which have been discarded. + */ + +static void +VCL_Nuke(struct vcls *vcl) +{ + + ASSERT_CLI(); + assert(vcl != vcl_active); + assert(vcl->conf->discard); + assert(vcl->conf->busy == 0); + VTAILQ_REMOVE(&vcl_head, vcl, list); + vcl->conf->fini_func(); + free(vcl->name); + free(vcl); +} + /*--------------------------------------------------------------------*/ void +VCL_Idle(void) +{ + struct vcls *vcl, *vcl2; + + ASSERT_CLI(); + VTAILQ_FOREACH_SAFE(vcl, &vcl_head, list, vcl2) + if (vcl->conf->discard && vcl->conf->busy == 0) + VCL_Nuke(vcl); +} + +/*--------------------------------------------------------------------*/ + +void cli_func_config_list(struct cli *cli, const char * const *av, void *priv) { struct vcls *vcl; (void)av; (void)priv; + ASSERT_CLI(); VTAILQ_FOREACH(vcl, &vcl_head, list) { cli_out(cli, "%s %6u %s\n", vcl == vcl_active ? "* " : " ", @@ -200,6 +228,7 @@ (void)av; (void)priv; + ASSERT_CLI(); if (VCL_Load(av[3], av[2], cli)) cli_result(cli, CLIS_PARAM); return; @@ -210,6 +239,7 @@ { struct vcls *vcl; + ASSERT_CLI(); (void)av; (void)priv; vcl = vcl_find(av[2]); @@ -218,11 +248,6 @@ cli_out(cli, "VCL '%s' unknown", av[2]); return; } - if (vcl->discard) { - cli_result(cli, CLIS_PARAM); - cli_out(cli, "VCL %s already discarded", av[2]); - return; - } LOCK(&vcl_mtx); if (vcl == vcl_active) { UNLOCK(&vcl_mtx); @@ -230,15 +255,10 @@ cli_out(cli, "VCL %s is the active VCL", av[2]); return; } - vcl->discard = 1; + vcl->conf->discard = 1; + UNLOCK(&vcl_mtx); if (vcl->conf->busy == 0) - VTAILQ_REMOVE(&vcl_head, vcl, list); - else - vcl = NULL; - UNLOCK(&vcl_mtx); - if (vcl != NULL) { - /* XXX dispose of vcl */ - } + VCL_Nuke(vcl); } void @@ -254,11 +274,6 @@ cli_result(cli, CLIS_PARAM); return; } - if (vcl->discard) { - cli_out(cli, "VCL '%s' has been discarded", av[2]); - cli_result(cli, CLIS_PARAM); - return; - } LOCK(&vcl_mtx); vcl_active = vcl; UNLOCK(&vcl_mtx); Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2008-02-05 10:50:33 UTC (rev 2430) +++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2008-02-05 11:19:22 UTC (rev 2431) @@ -630,5 +630,6 @@ VRT_fini_backend(struct backend *b) { + ASSERT_CLI(); VBE_DropRef(b); } From ssm at projects.linpro.no Tue Feb 5 19:41:11 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Tue, 5 Feb 2008 20:41:11 +0100 (CET) Subject: r2432 - trunk/varnish-tools/emacs Message-ID: <20080205194111.98F531EC1D1@projects.linpro.no> Author: ssm Date: 2008-02-05 20:41:11 +0100 (Tue, 05 Feb 2008) New Revision: 2432 Modified: trunk/varnish-tools/emacs/vcl-mode.el Log: Put vcl-mode.el nearer to working order * Clean up unused functions * Set default indent-level to 8 * Actually provide 'vcl-mode (quite useful) Modified: trunk/varnish-tools/emacs/vcl-mode.el =================================================================== --- trunk/varnish-tools/emacs/vcl-mode.el 2008-02-05 11:19:22 UTC (rev 2431) +++ trunk/varnish-tools/emacs/vcl-mode.el 2008-02-05 19:41:11 UTC (rev 2432) @@ -31,6 +31,9 @@ ;;; $Id$ ;;; +(defconst vcl-indent-level 8 + "The level of indentation (number of space characters) in VCL-mode.") + ;; I just love standards, there are so many to choose from (if (string-match "XEmacs\\|Lucid" emacs-version) (require 'generic-mode) @@ -145,9 +148,8 @@ (modify-syntax-entry ?. "w") ;; C++-style comments - (modify-syntax-entry ?/ ". 124b") + (modify-syntax-entry ?/ ". 124") (modify-syntax-entry ?* ". 23b") - (modify-syntax-entry ?\n ">b") ;; Perl-style comments (modify-syntax-entry ?# "<") @@ -159,8 +161,6 @@ (defvar vcl-mode-hook nil) -(defconst vcl-indent-level 2 "The indentation in VCL-mode") - (defun vcl-indent-line () "Indent the current VCL line according to syntax." (interactive) @@ -175,25 +175,24 @@ "Return the column to which the current line should be indented." (interactive) (save-excursion + ; Do not indent the first line. + (if (vcl-first-line-p) 0 ; Reduce indent level if we ; close a block on this line - (if (vcl-closing-tag-on-this-line-p) - (- (vcl-previous-line-indentation) - vcl-indent-level) + (if (vcl-closing-tag-on-this-line-p) + (- (vcl-previous-line-indentation) + vcl-indent-level) ; Increase indent level if a ; block opened on the previous ; line - (if (vcl-opening-tag-on-previous-line-p) - (+ (vcl-previous-line-indentation) - vcl-indent-level) - ; Do not indent empty lines - (if (vcl-empty-line-p) - 0 + (if (vcl-opening-tag-on-previous-line-p) + (+ (vcl-previous-line-indentation) + vcl-indent-level) ; By default, indent to the ; level of the previous ; non-empty line (vcl-previous-line-indentation)))))) - + (defun vcl-opening-tag-on-previous-line-p () "Checks if we have an opening tag on the previous line." (interactive) @@ -213,7 +212,7 @@ (looking-at "}"))) (defun vcl-previous-line-indentation () - "Return the column to which the current line should be indented." + "Return the indent level of the previous line." (interactive) (save-excursion (beginning-of-line) @@ -228,17 +227,11 @@ (beginning-of-line) (looking-at "^[ \t]*#"))) -(defun vcl-empty-line-p () - "Checks if we have an empty line." +(defun vcl-first-line-p () + "Checks if we are on the first line." (interactive) (save-excursion (beginning-of-line) - (looking-at "^[ \t]*$"))) + (eq (point) 1))) -(defun vcl-newline-and-indent () - "Insert a newline, updating indentation." - (interactive) - (save-excursion - (vcl-indent-line)) - (call-interactively 'newline-and-indent)) - +(provide 'vcl-mode) From ssm at projects.linpro.no Wed Feb 6 06:36:58 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Wed, 6 Feb 2008 07:36:58 +0100 (CET) Subject: r2433 - trunk/varnish-tools/emacs Message-ID: <20080206063658.8FA2D1EC2B2@projects.linpro.no> Author: ssm Date: 2008-02-06 07:36:58 +0100 (Wed, 06 Feb 2008) New Revision: 2433 Modified: trunk/varnish-tools/emacs/vcl-mode.el Log: Add vcl_fetch to list of subroutines Modified: trunk/varnish-tools/emacs/vcl-mode.el =================================================================== --- trunk/varnish-tools/emacs/vcl-mode.el 2008-02-05 19:41:11 UTC (rev 2432) +++ trunk/varnish-tools/emacs/vcl-mode.el 2008-02-06 06:36:58 UTC (rev 2433) @@ -75,6 +75,7 @@ "sub" "vcl_deliver" "vcl_discard" + "vcl_fetch" "vcl_hash" "vcl_hit" "vcl_miss" From ssm at projects.linpro.no Wed Feb 6 07:26:28 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Wed, 6 Feb 2008 08:26:28 +0100 (CET) Subject: r2434 - trunk/varnish-tools/emacs Message-ID: <20080206072628.A4AE41EC513@projects.linpro.no> Author: ssm Date: 2008-02-06 08:26:28 +0100 (Wed, 06 Feb 2008) New Revision: 2434 Modified: trunk/varnish-tools/emacs/vcl-mode.el Log: Add more settings to vcl-mode.el, and make them customizable Modified: trunk/varnish-tools/emacs/vcl-mode.el =================================================================== --- trunk/varnish-tools/emacs/vcl-mode.el 2008-02-06 06:36:58 UTC (rev 2433) +++ trunk/varnish-tools/emacs/vcl-mode.el 2008-02-06 07:26:28 UTC (rev 2434) @@ -31,9 +31,17 @@ ;;; $Id$ ;;; -(defconst vcl-indent-level 8 - "The level of indentation (number of space characters) in VCL-mode.") +(defgroup vcl nil + "Customizations for vcl-mode") +(defcustom vcl-indent-level 8 + "*The level of indentation (number of space characters) in VCL-mode." + :type 'integer :group 'vcl) + +(defcustom vcl-indent-tabs-mode nil + "*Allow tabs when indentation in vcl-mode if non-nil" + :type 'boolean :group 'vcl) + ;; I just love standards, there are so many to choose from (if (string-match "XEmacs\\|Lucid" emacs-version) (require 'generic-mode) @@ -158,6 +166,7 @@ (run-hooks 'vcl-mode-hook) (set (make-local-variable 'indent-line-function) 'vcl-indent-line) + (setq indent-tabs-mode vcl-indent-tabs-mode) ) (defvar vcl-mode-hook nil) From phk at projects.linpro.no Wed Feb 6 09:43:22 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 6 Feb 2008 10:43:22 +0100 (CET) Subject: r2435 - in trunk/varnish-cache: include lib/libvcl Message-ID: <20080206094322.5D9791EC2B1@projects.linpro.no> Author: phk Date: 2008-02-06 10:43:22 +0100 (Wed, 06 Feb 2008) New Revision: 2435 Modified: trunk/varnish-cache/include/vrt.h trunk/varnish-cache/lib/libvcl/vcc_backend.c trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c Log: I forgot to include the vcl_name of the random director in the structure. Modified: trunk/varnish-cache/include/vrt.h =================================================================== --- trunk/varnish-cache/include/vrt.h 2008-02-06 07:26:28 UTC (rev 2434) +++ trunk/varnish-cache/include/vrt.h 2008-02-06 09:43:22 UTC (rev 2435) @@ -71,9 +71,10 @@ }; struct vrt_dir_random { + const char *ident; + const char *name; unsigned nmember; const struct vrt_dir_random_entry *members; - const char *ident; }; struct vrt_random_backend { Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-02-06 07:26:28 UTC (rev 2434) +++ trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-02-06 09:43:22 UTC (rev 2435) @@ -425,6 +425,7 @@ Fc(tl, 0, "\nstatic const struct vrt_dir_random vdr_%.*s = {\n", PF(t_dir)); + Fc(tl, 0, "\t.name = \"%.*s\",\n", PF(t_dir)); Fc(tl, 0, "\t.nmember = %d,\n", nelem); Fc(tl, 0, "\t.members = vdre_%.*s,\n", PF(t_dir)); vcc_EmitBeIdent(tl->fc, t_first, tl->t); Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-02-06 07:26:28 UTC (rev 2434) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-02-06 09:43:22 UTC (rev 2435) @@ -423,9 +423,10 @@ vsb_cat(sb, "};\n"); vsb_cat(sb, "\n"); vsb_cat(sb, "struct vrt_dir_random {\n"); + vsb_cat(sb, " const char *ident;\n"); + vsb_cat(sb, " const char *name;\n"); vsb_cat(sb, " unsigned nmember;\n"); vsb_cat(sb, " const struct vrt_dir_random_entry *members;\n"); - vsb_cat(sb, " const char *ident;\n"); vsb_cat(sb, "};\n"); vsb_cat(sb, "\n"); vsb_cat(sb, "struct vrt_random_backend {\n"); From phk at projects.linpro.no Wed Feb 6 09:47:24 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 6 Feb 2008 10:47:24 +0100 (CET) Subject: r2436 - trunk/varnish-cache/bin/varnishd Message-ID: <20080206094724.E5E5D1EC21B@projects.linpro.no> Author: phk Date: 2008-02-06 10:47:24 +0100 (Wed, 06 Feb 2008) New Revision: 2436 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_backend.c trunk/varnish-cache/bin/varnishd/cache_backend_random.c trunk/varnish-cache/bin/varnishd/cache_backend_simple.c Log: VBE_AddBackend() needs to always return the backend, so make it a pointer arg and use the return int to tell if it was a reuse. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-02-06 09:43:22 UTC (rev 2435) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-02-06 09:47:24 UTC (rev 2436) @@ -443,7 +443,7 @@ extern struct backendlist backendlist; void VBE_DropRef(struct backend *); void VBE_DropRefLocked(struct backend *); -struct backend *VBE_AddBackend(struct backend_method *method, const char *ident); +int VBE_AddBackend(struct backend_method *method, const char *ident, struct backend **be); struct vbe_conn *VBE_NewConn(void); void VBE_ReleaseConn(struct vbe_conn *); void VBE_UpdateHealth(const struct sess *sp, const struct vbe_conn *, int); Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend.c 2008-02-06 09:43:22 UTC (rev 2435) +++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2008-02-06 09:47:24 UTC (rev 2436) @@ -326,13 +326,13 @@ /*-------------------------------------------------------------------- * Add a backend/director instance when loading a VCL. - * If an existing backend is matched, grab a refcount and return NULL. - * Else create a new backend structure and return that with reference - * initialized to one. + * If an existing backend is matched, grab a refcount and return one. + * Else create a new backend structure with reference initialized to one + * and return zero. */ -struct backend * -VBE_AddBackend(struct backend_method *method, const char *ident) +int +VBE_AddBackend(struct backend_method *method, const char *ident, struct backend **be) { struct backend *b; @@ -344,7 +344,8 @@ if (strcmp(b->ident, ident)) continue; b->refcount++; - return (NULL); + *be = b; + return (1); } b = calloc(sizeof *b, 1); @@ -361,7 +362,8 @@ b->minute_limit = 1; VTAILQ_INSERT_TAIL(&backendlist, b, list); - return (b); + *be = b; + return (0); } /*--------------------------------------------------------------------*/ Modified: trunk/varnish-cache/bin/varnishd/cache_backend_random.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend_random.c 2008-02-06 09:43:22 UTC (rev 2435) +++ trunk/varnish-cache/bin/varnishd/cache_backend_random.c 2008-02-06 09:47:24 UTC (rev 2436) @@ -439,8 +439,16 @@ void VRT_init_random_backend(struct backend **bp, const struct vrt_dir_random *t) { + struct backend *b; (void)bp; (void)t; + + if (VBE_AddBackend(&backend_method_random, t->ident, bp)) + return; /* reuse existing backend */ + + b = *bp; + AN(t->name); + REPLACE(b->vcl_name, t->name); #if 0 struct backend *b; struct ber *ber; Modified: trunk/varnish-cache/bin/varnishd/cache_backend_simple.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend_simple.c 2008-02-06 09:43:22 UTC (rev 2435) +++ trunk/varnish-cache/bin/varnishd/cache_backend_simple.c 2008-02-06 09:47:24 UTC (rev 2436) @@ -49,7 +49,6 @@ #define BES_MAGIC 0x015e17ac char *hostname; char *portname; - char *ident; struct addrinfo *addr; struct addrinfo *last_addr; double dnsttl; @@ -364,10 +363,13 @@ struct bes *bes; const char *p; - b = VBE_AddBackend(&backend_method_simple, t->ident); - if (b == NULL) + if (VBE_AddBackend(&backend_method_simple, t->ident, bp)) return; /* ref to existing backend */ + b = *bp; + AN(t->name); + REPLACE(b->vcl_name, t->name); + bes = calloc(sizeof *bes, 1); XXXAN(bes); bes->magic = BES_MAGIC; @@ -376,12 +378,6 @@ bes->dnsttl = 300; - AN(t->ident); - REPLACE(bes->ident, t->ident); - - AN(t->name); - REPLACE(b->vcl_name, t->name); - AN(t->host->portname); REPLACE(bes->portname, t->host->portname); @@ -398,6 +394,4 @@ if (p != NULL) printf("Warning: could not lookup backend %s (%s:%s): %s", b->vcl_name, bes->hostname, bes->portname, p); - - *bp = b; } From phk at projects.linpro.no Wed Feb 6 15:19:49 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 6 Feb 2008 16:19:49 +0100 (CET) Subject: r2437 - in trunk/varnish-cache: bin/varnishd include lib/libvcl Message-ID: <20080206151949.F03321EC412@projects.linpro.no> Author: phk Date: 2008-02-06 16:19:49 +0100 (Wed, 06 Feb 2008) New Revision: 2437 Added: trunk/varnish-cache/bin/varnishd/cache_dir_simple.c Modified: trunk/varnish-cache/bin/varnishd/Makefile.am trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_backend.c trunk/varnish-cache/bin/varnishd/cache_backend_random.c trunk/varnish-cache/bin/varnishd/cache_backend_simple.c trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/bin/varnishd/cache_fetch.c trunk/varnish-cache/bin/varnishd/cache_http.c trunk/varnish-cache/bin/varnishd/cache_main.c trunk/varnish-cache/bin/varnishd/cache_panic.c trunk/varnish-cache/bin/varnishd/cache_vcl.c trunk/varnish-cache/bin/varnishd/cache_vrt.c trunk/varnish-cache/include/vcl.h trunk/varnish-cache/include/vrt.h trunk/varnish-cache/include/vrt_obj.h trunk/varnish-cache/lib/libvcl/vcc_backend.c trunk/varnish-cache/lib/libvcl/vcc_compile.c trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl Log: First part of major backend overhaul. *** Please do not use -trunk in production until I say so again *** I have not entirely decided in the precise terminology, so the following may sound a lot more complicated than it really is: In VCL we can now have "backends" and "directors" both of which we treat as a "backend". When we define backends and directors in VCL, they refer to "backend hosts" which is just another way to say "hostname+portname" but later these will grow other parameters (max connections etc). A director is a piece of code that selects a "backend host" somehow, "random" and "round-robin" are the first algorithms. A backend can still be specified directly of course, that's the "simple director" that always return the same "backend host". This is probably where an example is in order: /* A backend as we know it */ backend b1 { .host = "fs"; .port = "80"; } /* A director */ director b2 random { { /* We can refer to named backends */ .backend = b1; .weight = 7; } { /* Or define them inline */ .backend = { .host = "fs2"; } .weight = 3; } } sub vcl_recv { if (req.url ~ "\[[a-z]]") { set req.backend = b2; } else { set req.backend = b1; } } This results in quite a lot of changes in the C code, VRT API and VCL compiler, the major thrust being: Directors like "simple" and "random" will not have to think about the actual connections to the backends, but just concentrate on selecting which backend should be used. When a new VCL is loaded, it will instantiate all directors, but try to reuse any preexisting "backend hosts" (which we still call "backend" in the C code). This is simple for a backend like "b1" in the example above, but sligthly more complex for the backend inlined in b2. The VCL compiler solves this, by qualifying the ident string for the inlined backend host with the prefix "b2 random :: 2 :: ", so that a reload of the same director with the same (unchanged) inline backend host will match, but none other will. One implication of instantiating all directors for every VCL load, is that private statistics cannot be reused, but stats on the backend host can. This is likely a very fine point of no consequence. Once the backend is selected by the director, the generic code in cache_backend.c will cope with reusing the connection pool, establishing connections and all that, moving most of the nastyness out of directors, leaving cache_dir_simple.c with only 96 lines of code, of which the license is a large fraction. Until now, we have done automatic DNS re-lookups, but they seem to cause more grief than advantage (I suspect some of the DNS lookups to be resposible for long timeouts), so that will be dropped, and instead we might add an explicit CLI command for this later. The code as here committed can handle a couple of simple requests, but there are a large number of INCOMPL()'s that need to be resolved before this is ready for prime time again. Modified: trunk/varnish-cache/bin/varnishd/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishd/Makefile.am 2008-02-06 09:47:24 UTC (rev 2436) +++ trunk/varnish-cache/bin/varnishd/Makefile.am 2008-02-06 15:19:49 UTC (rev 2437) @@ -18,6 +18,7 @@ cache_ban.c \ cache_center.c \ cache_cli.c \ + cache_dir_simple.c \ cache_expire.c \ cache_fetch.c \ cache_hash.c \ Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-02-06 09:47:24 UTC (rev 2436) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-02-06 15:19:49 UTC (rev 2437) @@ -76,6 +76,7 @@ struct workreq; struct addrinfo; struct esi_bit; +struct vrt_backend; /*--------------------------------------------------------------------*/ @@ -345,6 +346,7 @@ VTAILQ_ENTRY(sess) list; + struct director *director; struct backend *backend; struct bereq *bereq; struct object *obj; @@ -364,6 +366,23 @@ const char **hashptr; }; +/* ------------------------------------------------------------------- + * A director is a piece of code which selects one of possibly multiple + * backends to use. + */ + +typedef struct backend *vdi_choose_f(struct sess *sp); +typedef void vdi_fini_f(struct director *d); + +struct director { + unsigned magic; +#define DIRECTOR_MAGIC 0x3336351d + const char *name; + vdi_choose_f *choose; + vdi_fini_f *fini; + void *priv; +}; + /* -------------------------------------------------------------------*/ /* Backend connection */ @@ -376,46 +395,6 @@ void *priv; }; - -/* Backend method */ -typedef struct vbe_conn *vbe_getfd_f(const struct sess *sp); -typedef void vbe_close_f(struct worker *w, struct vbe_conn *vc); -typedef void vbe_recycle_f(struct worker *w, struct vbe_conn *vc); -typedef void vbe_init_f(void); -typedef const char *vbe_gethostname_f(const struct backend *); -typedef void vbe_cleanup_f(const struct backend *); -typedef void vbe_updatehealth_f(const struct sess *sp, const struct vbe_conn *vc, int); - -struct backend_method { - const char *name; - vbe_getfd_f *getfd; - vbe_close_f *close; - vbe_recycle_f *recycle; - vbe_cleanup_f *cleanup; - vbe_gethostname_f *gethostname; - vbe_updatehealth_f *updatehealth; - vbe_init_f *init; -}; - -/* Backend indstance */ -struct backend { - unsigned magic; -#define BACKEND_MAGIC 0x64c4c7c6 - char *vcl_name; - - VTAILQ_ENTRY(backend) list; - int refcount; - pthread_mutex_t mtx; - - struct backend_method *method; - const char *ident; - void *priv; - - int health; - double last_check; - int minute_limit; -}; - /* * NB: This list is not locked, it is only ever manipulated from the * cachers CLI thread. @@ -435,7 +414,7 @@ /* cache_backend.c */ void VBE_Init(void); -struct vbe_conn *VBE_GetFd(const struct sess *sp); +struct vbe_conn *VBE_GetFd(struct sess *sp); void VBE_ClosedFd(struct worker *w, struct vbe_conn *vc); void VBE_RecycleFd(struct worker *w, struct vbe_conn *vc); struct bereq * VBE_new_bereq(void); @@ -443,7 +422,7 @@ extern struct backendlist backendlist; void VBE_DropRef(struct backend *); void VBE_DropRefLocked(struct backend *); -int VBE_AddBackend(struct backend_method *method, const char *ident, struct backend **be); +struct backend *VBE_AddBackend(struct cli *cli, const struct vrt_backend *vb); struct vbe_conn *VBE_NewConn(void); void VBE_ReleaseConn(struct vbe_conn *); void VBE_UpdateHealth(const struct sess *sp, const struct vbe_conn *, int); @@ -452,11 +431,6 @@ int VBE_TryConnect(const struct sess *sp, const struct addrinfo *ai); int VBE_CheckFd(int fd); -/* cache_backend_simple.c */ -extern struct backend_method backend_method_simple; -extern struct backend_method backend_method_random; -extern struct backend_method backend_method_round_robin; - /* cache_ban.c */ void AddBan(const char *, int hash); void BAN_Init(void); Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend.c 2008-02-06 09:47:24 UTC (rev 2436) +++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2008-02-06 15:19:49 UTC (rev 2437) @@ -32,6 +32,7 @@ * */ +#include #include #include #include @@ -43,7 +44,31 @@ #include "heritage.h" #include "shmlog.h" #include "cache.h" +#include "vrt.h" +#include "cli_priv.h" +/* Backend indstance */ +struct backend { + unsigned magic; +#define BACKEND_MAGIC 0x64c4c7c6 + char *vcl_name; + + struct vrt_backend vrt[1]; + + VTAILQ_ENTRY(backend) list; + int refcount; + pthread_mutex_t mtx; + + const char *ident; + struct addrinfo *ai; + struct addrinfo *last_ai; + + VTAILQ_HEAD(, vbe_conn) connlist; + + int health; + double last_check; +}; + static VTAILQ_HEAD(,bereq) bereq_head = VTAILQ_HEAD_INITIALIZER(bereq_head); static VTAILQ_HEAD(,vbe_conn) vbe_head = VTAILQ_HEAD_INITIALIZER(vbe_head); @@ -217,20 +242,27 @@ VBE_DropRefLocked(struct backend *b) { int i; + struct vbe_conn *vbe, *vbe2; CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC); i = --b->refcount; - if (i == 0) { - ASSERT_CLI(); /* XXX: ?? */ - VTAILQ_REMOVE(&backendlist, b, list); - } UNLOCK(&b->mtx); if (i) return; + + ASSERT_CLI(); /* XXX: ?? */ + VTAILQ_REMOVE(&backendlist, b, list); + VTAILQ_FOREACH_SAFE(vbe, &b->connlist, list, vbe2) { + VTAILQ_REMOVE(&b->connlist, vbe, list); + if (vbe->fd >= 0) + AZ(close(vbe->fd)); + FREE_OBJ(vbe); + } + free(TRUST_ME(b->vrt->ident)); + free(TRUST_ME(b->vrt->hostname)); + free(TRUST_ME(b->vrt->portname)); b->magic = 0; - b->method->cleanup(b); - free(b->vcl_name); free(b); } @@ -244,17 +276,116 @@ VBE_DropRefLocked(b); } +/*-------------------------------------------------------------------- + * Try to get a socket connected to one of the addresses on the list. + * We start from the cached "last good" address and try all items on + * the list exactly once. + * If a new DNS lookup is made while we try, we start over and try the + * new list exactly once. + */ + +static int +bes_conn_try_list(const struct sess *sp, struct backend *bp) +{ + struct addrinfo *ai, *from; + int s, loops; + + CHECK_OBJ_NOTNULL(bp, BACKEND_MAGIC); + if (bp->last_ai == NULL) + return (-1); + AN(bp->ai); + + /* Called with lock held */ + loops = 0; + ai = from = bp->last_ai; + while (1) { + + /* NB: releases/acquires backend lock */ + s = VBE_TryConnect(sp, ai); + + if (s >= 0) { + bp->last_ai = ai; + return (s); + } + + /* Try next one */ + ai = ai->ai_next; + if (ai == NULL) { + loops++; + ai = bp->ai; + } + if (loops == 1 && ai == from) + return (-1); + } +} + + /*--------------------------------------------------------------------*/ +static int +bes_conn_try(const struct sess *sp, struct backend *bp) +{ + int s; + + LOCK(&bp->mtx); + + s = bes_conn_try_list(sp, bp); + if (s >= 0) { + bp->refcount++; + UNLOCK(&bp->mtx); + return (s); + } + UNLOCK(&bp->mtx); + return (-1); +} + +/*--------------------------------------------------------------------*/ + struct vbe_conn * -VBE_GetFd(const struct sess *sp) +VBE_GetFd(struct sess *sp) { + struct backend *bp; + struct vbe_conn *vc; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - CHECK_OBJ_NOTNULL(sp->backend, BACKEND_MAGIC); - AN(sp->backend->method); - AN(sp->backend->method->getfd); - return(sp->backend->method->getfd(sp)); + CHECK_OBJ_NOTNULL(sp->director, DIRECTOR_MAGIC); + bp = sp->director->choose(sp); + CHECK_OBJ_NOTNULL(bp, BACKEND_MAGIC); + sp->backend = bp; + + while (1) { + LOCK(&bp->mtx); + vc = VTAILQ_FIRST(&bp->connlist); + if (vc != NULL) { + bp->refcount++; + assert(vc->backend == bp); + assert(vc->fd >= 0); + VTAILQ_REMOVE(&bp->connlist, vc, list); + } + UNLOCK(&bp->mtx); + if (vc == NULL) + break; + if (VBE_CheckFd(vc->fd)) { + /* XXX locking of stats */ + VSL_stats->backend_reuse += 1; + VSL_stats->backend_conn++; + return (vc); + } + VBE_ClosedFd(sp->wrk, vc); + } + + vc = VBE_NewConn(); + assert(vc->fd == -1); + AZ(vc->backend); + vc->fd = bes_conn_try(sp, bp); + if (vc->fd < 0) { + VBE_ReleaseConn(vc); + VSL_stats->backend_fail++; + return (NULL); + } + vc->backend = bp; + VSL_stats->backend_conn++; + return (vc); } /* Close a connection ------------------------------------------------*/ @@ -263,13 +394,19 @@ VBE_ClosedFd(struct worker *w, struct vbe_conn *vc) { struct backend *b; + int i; CHECK_OBJ_NOTNULL(vc, VBE_CONN_MAGIC); CHECK_OBJ_NOTNULL(vc->backend, BACKEND_MAGIC); b = vc->backend; - AN(b->method); - AN(b->method->close); - b->method->close(w, vc); + assert(vc->fd >= 0); + WSL(w, SLT_BackendClose, vc->fd, "%s", vc->backend->vcl_name); + i = close(vc->fd); + assert(i == 0 || errno == ECONNRESET || errno == ENOTCONN); + vc->fd = -1; + VBE_DropRef(vc->backend); + vc->backend = NULL; + VBE_ReleaseConn(vc); CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC); } @@ -278,15 +415,18 @@ void VBE_RecycleFd(struct worker *w, struct vbe_conn *vc) { - struct backend *b; + struct backend *bp; CHECK_OBJ_NOTNULL(vc, VBE_CONN_MAGIC); CHECK_OBJ_NOTNULL(vc->backend, BACKEND_MAGIC); - b = vc->backend; - AN(b->method); - AN(b->method->recycle); - b->method->recycle(w, vc); - CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC); + assert(vc->fd >= 0); + bp = vc->backend; + WSL(w, SLT_BackendReuse, vc->fd, "%s", vc->backend->vcl_name); + LOCK(&vc->backend->mtx); + VSL_stats->backend_recycle++; + VTAILQ_INSERT_HEAD(&bp->connlist, vc, list); + VBE_DropRefLocked(vc->backend); + CHECK_OBJ_NOTNULL(bp, BACKEND_MAGIC); } /* Update health ----------------------------------------------------*/ @@ -296,6 +436,11 @@ void VBE_UpdateHealth(const struct sess *sp, const struct vbe_conn *vc, int a) { + (void)sp; + (void)vc; + (void)a; +#if 0 + INCOMPL(); struct backend *b; if (vc != NULL) { @@ -312,16 +457,47 @@ if(b->method->updatehealth != NULL) b->method->updatehealth(sp, vc, a); CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC); +#endif } -/*--------------------------------------------------------------------*/ +/*-------------------------------------------------------------------- + * DNS lookup of backend host/port + */ static void -VBE_AddBackendMethod(const struct backend_method *bem) +vbe_dns_lookup(struct cli *cli, struct backend *bp) { + int error; + struct addrinfo *res, hint, *old; - if (bem->init != NULL) - bem->init(); + CHECK_OBJ_NOTNULL(bp, BACKEND_MAGIC); + + memset(&hint, 0, sizeof hint); + hint.ai_family = PF_UNSPEC; + hint.ai_socktype = SOCK_STREAM; + res = NULL; + error = getaddrinfo(bp->vrt->hostname, bp->vrt->portname, + &hint, &res); + if (error) { + if (res != NULL) + freeaddrinfo(res); + /* + * We cannot point to the source code any more, it may + * be long gone from memory. We already checked over in + * the VCL compiler, so this is only relevant for refreshes. + * XXX: which we do when exactly ? + */ + cli_out(cli, "DNS(/hosts) lookup failed for (%s/%s): %s", + bp->vrt->hostname, bp->vrt->portname, gai_strerror(error)); + return; + } + LOCK(&bp->mtx); + old = bp->ai; + bp->ai = res; + bp->last_ai = res; + UNLOCK(&bp->mtx); + if (old != NULL) + freeaddrinfo(old); } /*-------------------------------------------------------------------- @@ -331,51 +507,74 @@ * and return zero. */ -int -VBE_AddBackend(struct backend_method *method, const char *ident, struct backend **be) +struct backend * +VBE_AddBackend(struct cli *cli, const struct vrt_backend *vb) { struct backend *b; + AN(vb->hostname); + AN(vb->portname); + AN(vb->ident); + (void)cli; ASSERT_CLI(); VTAILQ_FOREACH(b, &backendlist, list) { CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC); - if (b->method != method) + if (strcmp(b->ident, vb->ident)) continue; - if (strcmp(b->ident, ident)) - continue; b->refcount++; - *be = b; - return (1); + return (b); } b = calloc(sizeof *b, 1); XXXAN(b); b->magic = BACKEND_MAGIC; - b->method = method; - b->ident = strdup(ident); - XXXAN(b->ident); + VTAILQ_INIT(&b->connlist); + memcpy(b->vrt, vb, sizeof *vb); + /* + * This backend may live longer than the VCL that instantiated it + * so we cannot simply reference the VCL's copy of the strings. + */ + b->vrt->ident = strdup(vb->ident); + XXXAN(b->vrt->ident); + b->vrt->hostname = strdup(vb->hostname); + XXXAN(b->vrt->hostname); + b->vrt->portname = strdup(vb->portname); + XXXAN(b->vrt->portname); + MTX_INIT(&b->mtx); b->refcount = 1; + vbe_dns_lookup(cli, b); + b->last_check = TIM_mono(); - b->minute_limit = 1; + vbe_dns_lookup(cli, b); + VTAILQ_INSERT_TAIL(&backendlist, b, list); - *be = b; - return (0); + return (b); } + /*--------------------------------------------------------------------*/ void -VBE_Init(void) +VRT_fini_dir(struct cli *cli, struct director *b) { - MTX_INIT(&VBE_mtx); - VBE_AddBackendMethod(&backend_method_simple); - VBE_AddBackendMethod(&backend_method_random); + ASSERT_CLI(); #if 0 - VBE_AddBackendMethod(&backend_method_round_robin); + VBE_DropRef(b); +#else + (void)b; + (void)cli; #endif } +/*--------------------------------------------------------------------*/ + +void +VBE_Init(void) +{ + + MTX_INIT(&VBE_mtx); +} Modified: trunk/varnish-cache/bin/varnishd/cache_backend_random.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend_random.c 2008-02-06 09:47:24 UTC (rev 2436) +++ trunk/varnish-cache/bin/varnishd/cache_backend_random.c 2008-02-06 15:19:49 UTC (rev 2437) @@ -45,6 +45,7 @@ #include "vrt.h" +#if 0 struct ber { unsigned magic; #define BER_MAGIC 0x645b03f4 @@ -434,22 +435,27 @@ .cleanup = ber_Cleanup, }; +#endif + /*--------------------------------------------------------------------*/ void -VRT_init_random_backend(struct backend **bp, const struct vrt_dir_random *t) +VRT_init_dir_random(struct cli *cli, struct director **bp, const struct vrt_dir_random *t) { - struct backend *b; + (void)cli; (void)bp; (void)t; + +#if 0 + struct backend *b; + if (VBE_AddBackend(&backend_method_random, t->ident, bp)) return; /* reuse existing backend */ - b = *bp; + bp = *bp; AN(t->name); REPLACE(b->vcl_name, t->name); -#if 0 struct backend *b; struct ber *ber; struct vrt_backend_entry *be; Modified: trunk/varnish-cache/bin/varnishd/cache_backend_simple.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend_simple.c 2008-02-06 09:47:24 UTC (rev 2436) +++ trunk/varnish-cache/bin/varnishd/cache_backend_simple.c 2008-02-06 15:19:49 UTC (rev 2437) @@ -44,6 +44,8 @@ #include "cache.h" #include "vrt.h" +#if 0 + struct bes { unsigned magic; #define BES_MAGIC 0x015e17ac @@ -343,55 +345,5 @@ return (bes->hostname); } -/*--------------------------------------------------------------------*/ -struct backend_method backend_method_simple = { - .name = "simple", - .getfd = bes_GetFd, - .close = bes_ClosedFd, - .recycle = bes_RecycleFd, - .gethostname = bes_GetHostname, - .cleanup = bes_Cleanup, -}; - -/*--------------------------------------------------------------------*/ - -void -VRT_init_simple_backend(struct backend **bp, const struct vrt_simple_backend *t) -{ - struct backend *b; - struct bes *bes; - const char *p; - - if (VBE_AddBackend(&backend_method_simple, t->ident, bp)) - return; /* ref to existing backend */ - - b = *bp; - AN(t->name); - REPLACE(b->vcl_name, t->name); - - bes = calloc(sizeof *bes, 1); - XXXAN(bes); - bes->magic = BES_MAGIC; - - b->priv = bes; - - bes->dnsttl = 300; - - AN(t->host->portname); - REPLACE(bes->portname, t->host->portname); - - AN(t->host->hostname); - REPLACE(bes->hostname, t->host->hostname); - - /* - * The VCL compiler already did a lookup, but we'll do another one - * here, just in case... - */ - LOCK(&b->mtx); - p = bes_dns_lookup(b); - UNLOCK(&b->mtx); - if (p != NULL) - printf("Warning: could not lookup backend %s (%s:%s): %s", - b->vcl_name, bes->hostname, bes->portname, p); -} +#endif Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2008-02-06 09:47:24 UTC (rev 2436) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2008-02-06 15:19:49 UTC (rev 2437) @@ -195,7 +195,12 @@ AZ(sp->obj); AZ(sp->bereq); - sp->backend = NULL; + sp->director = NULL; + sp->backend = NULL; /* + * XXX: we may want to leave this + * behind to hint directors ? + */ + if (sp->vcl != NULL) { if (sp->wrk->vcl != NULL) VCL_Rel(&sp->wrk->vcl); @@ -320,9 +325,9 @@ CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC); AN(sp->bereq); - CHECK_OBJ_NOTNULL(sp->backend, BACKEND_MAGIC); + CHECK_OBJ_NOTNULL(sp->director, DIRECTOR_MAGIC); i = Fetch(sp); - CHECK_OBJ_NOTNULL(sp->backend, BACKEND_MAGIC); + CHECK_OBJ_NOTNULL(sp->director, DIRECTOR_MAGIC); if (!i) RFC2616_cache_policy(sp, sp->obj->http); /* XXX -> VCL */ @@ -841,9 +846,9 @@ sp->doclose = http_DoConnection(sp->http); /* By default we use the first backend */ - AZ(sp->backend); - sp->backend = sp->vcl->backend[0]; - CHECK_OBJ_NOTNULL(sp->backend, BACKEND_MAGIC); + AZ(sp->director); + sp->director = sp->vcl->director[0]; + CHECK_OBJ_NOTNULL(sp->director, DIRECTOR_MAGIC); /* XXX: Handle TRACE & OPTIONS of Max-Forwards = 0 */ @@ -879,7 +884,7 @@ CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC); CHECK_OBJ_ORNULL(w->nobj, OBJECT_MAGIC); CHECK_OBJ_ORNULL(w->nobjhead, OBJHEAD_MAGIC); - CHECK_OBJ_ORNULL(sp->backend, BACKEND_MAGIC); + CHECK_OBJ_ORNULL(sp->director, DIRECTOR_MAGIC); switch (sp->step) { #ifdef DIAGNOSTICS Added: trunk/varnish-cache/bin/varnishd/cache_dir_simple.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_dir_simple.c (rev 0) +++ trunk/varnish-cache/bin/varnishd/cache_dir_simple.c 2008-02-06 15:19:49 UTC (rev 2437) @@ -0,0 +1,96 @@ +/*- + * Copyright (c) 2006 Verdens Gang AS + * Copyright (c) 2006-2008 Linpro AS + * All rights reserved. + * + * Author: Poul-Henning Kamp + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id$ + * + */ + +#include +#include + +#include +#include +#include +#include +#include + +#include "shmlog.h" +#include "cache.h" +#include "vrt.h" + +/*--------------------------------------------------------------------*/ + +struct vdi_simple { + unsigned magic; +#define VDI_SIMPLE_MAGIC 0x476d25b7 + struct director dir; + struct backend *backend; +}; + +static struct backend * +vdi_simple_choose(struct sess *sp) +{ + struct vdi_simple *vs; + + CHECK_OBJ_NOTNULL(sp->director, DIRECTOR_MAGIC); + CAST_OBJ_NOTNULL(vs, sp->director->priv, VDI_SIMPLE_MAGIC); + return (vs->backend); +} + +static void +vdi_simple_fini(struct director *d) +{ + struct vdi_simple *vs; + + CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); + CAST_OBJ_NOTNULL(vs, d->priv, VDI_SIMPLE_MAGIC); + + VBE_DropRef(vs->backend); + free(vs); +} + +void +VRT_init_dir_simple(struct cli *cli, struct director **bp, const struct vrt_dir_simple *t) +{ + struct vdi_simple *vs; + + (void)cli; + + vs = calloc(sizeof *vs, 1); + XXXAN(vs); + vs->magic = VDI_SIMPLE_MAGIC; + vs->dir.magic = DIRECTOR_MAGIC; + vs->dir.priv = vs; + vs->dir.name = "simple"; + vs->dir.choose = vdi_simple_choose; + vs->dir.fini = vdi_simple_fini; + + vs->backend = VBE_AddBackend(cli, t->host); + + *bp = &vs->dir; +} Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2008-02-06 09:47:24 UTC (rev 2436) +++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2008-02-06 15:19:49 UTC (rev 2437) @@ -309,7 +309,7 @@ CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); CHECK_OBJ_NOTNULL(sp->bereq, BEREQ_MAGIC); - CHECK_OBJ_NOTNULL(sp->backend, BACKEND_MAGIC); + CHECK_OBJ_NOTNULL(sp->director, DIRECTOR_MAGIC); assert(sp->obj->busy != 0); w = sp->wrk; bereq = sp->bereq; Modified: trunk/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_http.c 2008-02-06 09:47:24 UTC (rev 2436) +++ trunk/varnish-cache/bin/varnishd/cache_http.c 2008-02-06 15:19:49 UTC (rev 2437) @@ -649,8 +649,11 @@ /* XXX: This really ought to go into the default VCL */ if (!http_GetHdr(hp, H_Host, &b)) { +#if 0 http_PrintfHeader(sp->wrk, sp->fd, hp, "Host: %s", sp->backend->method->gethostname(sp->backend)); +#endif + INCOMPL(); } sp->bereq = bereq; } Modified: trunk/varnish-cache/bin/varnishd/cache_main.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_main.c 2008-02-06 09:47:24 UTC (rev 2436) +++ trunk/varnish-cache/bin/varnishd/cache_main.c 2008-02-06 15:19:49 UTC (rev 2437) @@ -83,7 +83,6 @@ SZOF(struct objhead); SZOF(struct sess); SZOF(struct vbe_conn); - SZOF(struct backend); CNT_Init(); Modified: trunk/varnish-cache/bin/varnishd/cache_panic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_panic.c 2008-02-06 09:47:24 UTC (rev 2436) +++ trunk/varnish-cache/bin/varnishd/cache_panic.c 2008-02-06 15:19:49 UTC (rev 2437) @@ -131,6 +131,7 @@ fp(" },\n"); } +#if 0 /* dump a struct backend */ static void dump_backend(const struct backend *be) @@ -141,12 +142,15 @@ be->vcl_name ? be->vcl_name : "(null)"); fp(" },\n"); } +#endif /* dump a struct sess */ static void dump_sess(const struct sess *sp) { +#if 0 const struct backend *be = sp->backend; +#endif const struct object *obj = sp->obj; fp("sp = %p {\n", sp); @@ -162,8 +166,11 @@ fp(" err_code = %d, err_reason = %s,\n", sp->err_code, sp->err_reason ? sp->err_reason : "(null)"); +#if 0 if (VALID_OBJ(be, BACKEND_MAGIC)) dump_backend(be); + INCOMPL(): +#endif if (VALID_OBJ(obj, OBJECT_MAGIC)) dump_object(obj); Modified: trunk/varnish-cache/bin/varnishd/cache_vcl.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vcl.c 2008-02-06 09:47:24 UTC (rev 2436) +++ trunk/varnish-cache/bin/varnishd/cache_vcl.c 2008-02-06 15:19:49 UTC (rev 2437) @@ -168,7 +168,7 @@ vcl_active = vcl; UNLOCK(&vcl_mtx); cli_out(cli, "Loaded \"%s\" as \"%s\"\n", fn , name); - vcl->conf->init_func(); + vcl->conf->init_func(cli); return (0); } @@ -186,7 +186,7 @@ assert(vcl->conf->discard); assert(vcl->conf->busy == 0); VTAILQ_REMOVE(&vcl_head, vcl, list); - vcl->conf->fini_func(); + vcl->conf->fini_func(NULL); free(vcl->name); free(vcl); } Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2008-02-06 09:47:24 UTC (rev 2436) +++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2008-02-06 15:19:49 UTC (rev 2437) @@ -391,17 +391,17 @@ /*--------------------------------------------------------------------*/ void -VRT_l_req_backend(struct sess *sp, struct backend *be) +VRT_l_req_backend(struct sess *sp, struct director *be) { CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - sp->backend = be; + sp->director = be; } -struct backend * +struct director * VRT_r_req_backend(struct sess *sp) { CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - return (sp->backend); + return (sp->director); } /*--------------------------------------------------------------------*/ @@ -543,10 +543,14 @@ int VRT_r_backend_health(const struct sess *sp) { - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); +#if 0 CHECK_OBJ_NOTNULL(sp->backend, BACKEND_MAGIC); return (sp->backend->health); +#else + INCOMPL(); + return (0); +#endif } /*--------------------------------------------------------------------*/ @@ -621,15 +625,3 @@ return (strcmp(s1, s2)); } - -/*-------------------------------------------------------------------- - * Backend stuff - */ - -void -VRT_fini_backend(struct backend *b) -{ - - ASSERT_CLI(); - VBE_DropRef(b); -} Modified: trunk/varnish-cache/include/vcl.h =================================================================== --- trunk/varnish-cache/include/vcl.h 2008-02-06 09:47:24 UTC (rev 2436) +++ trunk/varnish-cache/include/vcl.h 2008-02-06 15:19:49 UTC (rev 2437) @@ -7,17 +7,18 @@ */ struct sess; +struct cli; -typedef void vcl_init_f(void); -typedef void vcl_fini_f(void); +typedef void vcl_init_f(struct cli *); +typedef void vcl_fini_f(struct cli *); typedef int vcl_func_f(struct sess *sp); struct VCL_conf { unsigned magic; #define VCL_CONF_MAGIC 0x7406c509 /* from /dev/random */ - struct backend **backend; - unsigned nbackend; + struct director **director; + unsigned ndirector; struct vrt_ref *ref; unsigned nref; unsigned busy; Modified: trunk/varnish-cache/include/vrt.h =================================================================== --- trunk/varnish-cache/include/vrt.h 2008-02-06 09:47:24 UTC (rev 2436) +++ trunk/varnish-cache/include/vrt.h 2008-02-06 15:19:49 UTC (rev 2437) @@ -36,55 +36,51 @@ struct sess; struct vsb; -struct backend; +struct cli; +struct director; struct VCL_conf; struct sockaddr; -struct vrt_backend_host { +/* + * A backend is a host+port somewhere on the network + */ +struct vrt_backend { const char *portname; const char *hostname; const char *ident; }; -struct vrt_simple_backend { - const char *ident; - const char *name; - const struct vrt_backend_host *host; -}; +/* + * A director with a predictable reply + */ -struct vrt_backend_entry { - const char *port; - const char *host; - double weight; - struct vrt_backend_entry *next; +struct vrt_dir_simple { + const char *ident; + const char *name; + const struct vrt_backend *host; }; -struct vrt_round_robin_backend { - const char *name; - unsigned count; - struct vrt_backend_entry *bentry; -}; +/* + * A director with an unpredictable reply + */ struct vrt_dir_random_entry { - const struct vrt_backend_host *host; - double weight; + const struct vrt_backend *host; + double weight; }; struct vrt_dir_random { - const char *ident; - const char *name; - unsigned nmember; + const char *ident; + const char *name; + unsigned nmember; const struct vrt_dir_random_entry *members; }; -struct vrt_random_backend { - const char *name; - unsigned weighted; - unsigned count; - struct vrt_backend_entry *bentry; -}; +/* + * other stuff. + * XXX: document when bored + */ - struct vrt_ref { unsigned source; unsigned offset; @@ -134,10 +130,9 @@ void VRT_Rollback(struct sess *sp); /* Backend related */ -void VRT_init_simple_backend(struct backend **, const struct vrt_simple_backend *); -void VRT_init_round_robin_backend(struct backend **, const struct vrt_round_robin_backend *); -void VRT_init_random_backend(struct backend **, const struct vrt_dir_random *); -void VRT_fini_backend(struct backend *); +void VRT_init_dir_simple(struct cli *, struct director **, const struct vrt_dir_simple *); +void VRT_init_dir_random(struct cli *, struct director **, const struct vrt_dir_random *); +void VRT_fini_dir(struct cli *, struct director *); char *VRT_IP_string(const struct sess *sp, const struct sockaddr *sa); char *VRT_int_string(const struct sess *sp, int); Modified: trunk/varnish-cache/include/vrt_obj.h =================================================================== --- trunk/varnish-cache/include/vrt_obj.h 2008-02-06 09:47:24 UTC (rev 2436) +++ trunk/varnish-cache/include/vrt_obj.h 2008-02-06 15:19:49 UTC (rev 2437) @@ -15,8 +15,8 @@ const char * VRT_r_req_proto(const struct sess *); void VRT_l_req_proto(const struct sess *, const char *, ...); void VRT_l_req_hash(struct sess *, const char *); -struct backend * VRT_r_req_backend(struct sess *); -void VRT_l_req_backend(struct sess *, struct backend *); +struct director * VRT_r_req_backend(struct sess *); +void VRT_l_req_backend(struct sess *, struct director *); int VRT_r_req_restarts(const struct sess *); double VRT_r_req_grace(struct sess *); void VRT_l_req_grace(struct sess *, double); Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-02-06 09:47:24 UTC (rev 2436) +++ trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-02-06 15:19:49 UTC (rev 2437) @@ -70,10 +70,16 @@ */ static void -vcc_EmitBeIdent(struct vsb *v, const struct token *first, const struct token *last) +vcc_EmitBeIdent(struct vsb *v, const struct token *qual, int serial, const struct token *first, const struct token *last) { vsb_printf(v, "\t.ident ="); + if (qual != NULL) { + vsb_printf(v, "\n\t \"%.*s \"", PF(qual)); + qual = VTAILQ_NEXT(qual, list); + vsb_printf(v, "\n\t \"%.*s \"", PF(qual)); + vsb_printf(v, "\n\t \":: %d :: \"", serial); + } while (first != last) { if (first->dec != NULL) vsb_printf(v, "\n\t \"\\\"\" %.*s \"\\\" \"", @@ -201,11 +207,11 @@ * be_element: * '.' name '=' value ';' * - * The struct vrt_backend_host is emitted to Fh(). + * The struct vrt_backend is emitted to Fh(). */ static void -vcc_ParseBackendHost(struct tokenlist *tl, int *nbh) +vcc_ParseBackendHost(struct tokenlist *tl, int *nbh, const struct token *qual, int serial) { struct token *t_field; struct token *t_first; @@ -240,7 +246,7 @@ vcc_NextToken(tl); *nbh = tl->nbackend_host++; - Fh(tl, 0, "\nstatic const struct vrt_backend_host bh_%d = {\n", *nbh); + Fh(tl, 0, "\nstatic const struct vrt_backend bh_%d = {\n", *nbh); /* Check for old syntax */ if (tl->t->tok == ID && vcc_IdIs(tl->t, "set")) { @@ -298,7 +304,7 @@ EncToken(tl->fh, t_host); Fh(tl, 0, ",\n"); - /* Check that the hostname makes sense */ + /* Check that the portname makes sense */ if (t_port != NULL) { ep = CheckHostPort(t_host->dec, t_port->dec); if (ep != NULL) { @@ -310,10 +316,12 @@ Fh(tl, 0, "\t.portname = "); EncToken(tl->fh, t_port); Fh(tl, 0, ",\n"); + } else { + Fh(tl, 0, "\t.portname = \"80\",\n"); } ExpectErr(tl, '}'); - vcc_EmitBeIdent(tl->fh, t_first, tl->t); + vcc_EmitBeIdent(tl->fh, qual, serial, t_first, tl->t); Fh(tl, 0, "};\n"); vcc_NextToken(tl); } @@ -338,27 +346,28 @@ h->name = tl->t; vcc_NextToken(tl); - vcc_ParseBackendHost(tl, &nbh); + vcc_ParseBackendHost(tl, &nbh, NULL, 0); ERRCHK(tl); h->hnum = nbh; VTAILQ_INSERT_TAIL(&tl->hosts, h, list); /* In the compiled vcl we use these macros to refer to backends */ - Fh(tl, 1, "\n#define VGC_backend_%.*s (VCL_conf.backend[%d])\n", + Fh(tl, 1, "\n#define VGC_backend_%.*s (VCL_conf.director[%d])\n", PF(h->name), tl->nbackend); vcc_AddDef(tl, h->name, R_BACKEND); - Fi(tl, 0, "\tVRT_init_simple_backend(&VGC_backend_%.*s , &sbe_%.*s);\n", + Fi(tl, 0, + "\tVRT_init_dir_simple(cli, &VGC_backend_%.*s , &sbe_%.*s);\n", PF(h->name), PF(h->name)); - Ff(tl, 0, "\tVRT_fini_backend(VGC_backend_%.*s);\n", PF(h->name)); + Ff(tl, 0, "\tVRT_fini_dir(cli, VGC_backend_%.*s);\n", PF(h->name)); - Fc(tl, 0, "\nstatic const struct vrt_simple_backend sbe_%.*s = {\n", + Fc(tl, 0, "\nstatic const struct vrt_dir_simple sbe_%.*s = {\n", PF(h->name)); Fc(tl, 0, "\t.name = \"%.*s\",\n", PF(h->name)); Fc(tl, 0, "\t.host = &bh_%d,\n", nbh); - vcc_EmitBeIdent(tl->fc, t_first, tl->t); + vcc_EmitBeIdent(tl->fc, NULL, 0, t_first, tl->t); Fc(tl, 0, "};\n"); tl->nbackend++; @@ -375,7 +384,7 @@ int nbh, nelem; struct fld_spec *fs; - Fh(tl, 1, "\n#define VGC_backend_%.*s (VCL_conf.backend[%d])\n", + Fh(tl, 1, "\n#define VGC_backend_%.*s (VCL_conf.director[%d])\n", PF(t_dir), tl->nbackend); vcc_AddDef(tl, t_dir, R_BACKEND); @@ -402,7 +411,7 @@ vcc_IsField(tl, &t_field, fs); ERRCHK(tl); if (vcc_IdIs(t_field, "backend")) { - vcc_ParseBackendHost(tl, &nbh); + vcc_ParseBackendHost(tl, &nbh, t_dir, nelem); Fc(tl, 0, " .host = &bh_%d,", nbh); ERRCHK(tl); } else if (vcc_IdIs(t_field, "weight")) { @@ -428,12 +437,13 @@ Fc(tl, 0, "\t.name = \"%.*s\",\n", PF(t_dir)); Fc(tl, 0, "\t.nmember = %d,\n", nelem); Fc(tl, 0, "\t.members = vdre_%.*s,\n", PF(t_dir)); - vcc_EmitBeIdent(tl->fc, t_first, tl->t); + vcc_EmitBeIdent(tl->fc, NULL, 0, t_first, tl->t); Fc(tl, 0, "};\n"); vcc_NextToken(tl); - Fi(tl, 0, "\tVRT_init_random_backend(&VGC_backend_%.*s , &vdr_%.*s);\n", + Fi(tl, 0, + "\tVRT_init_dir_random(cli, &VGC_backend_%.*s , &vdr_%.*s);\n", PF(t_dir), PF(t_dir)); - Ff(tl, 0, "\tVRT_fini_backend(VGC_backend_%.*s);\n", PF(t_dir)); + Ff(tl, 0, "\tVRT_fini_dir(cli, VGC_backend_%.*s);\n", PF(t_dir)); } /*-------------------------------------------------------------------- Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.c 2008-02-06 09:47:24 UTC (rev 2436) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.c 2008-02-06 15:19:49 UTC (rev 2437) @@ -295,7 +295,7 @@ EmitInitFunc(const struct tokenlist *tl) { - Fc(tl, 0, "\nstatic void\nVGC_Init(void)\n{\n\n"); + Fc(tl, 0, "\nstatic void\nVGC_Init(struct cli *cli)\n{\n\n"); vsb_finish(tl->fi); /* XXX: check vsb_overflowed ? */ vsb_cat(tl->fc, vsb_data(tl->fi)); @@ -306,7 +306,7 @@ EmitFiniFunc(const struct tokenlist *tl) { - Fc(tl, 0, "\nstatic void\nVGC_Fini(void)\n{\n\n"); + Fc(tl, 0, "\nstatic void\nVGC_Fini(struct cli *cli)\n{\n\n"); vsb_finish(tl->ff); /* XXX: check vsb_overflowed ? */ vsb_cat(tl->fc, vsb_data(tl->ff)); @@ -339,14 +339,14 @@ } Fc(tl, 0, "};\n"); - Fc(tl, 0, "\nstatic struct backend\t*backends[%d];\n", tl->nbackend); + Fc(tl, 0, "\nstatic struct director\t*directors[%d];\n", tl->nbackend); Fc(tl, 0, "\nconst struct VCL_conf VCL_conf = {\n"); Fc(tl, 0, "\t.magic = VCL_CONF_MAGIC,\n"); Fc(tl, 0, "\t.init_func = VGC_Init,\n"); Fc(tl, 0, "\t.fini_func = VGC_Fini,\n"); - Fc(tl, 0, "\t.nbackend = %d,\n", tl->nbackend); - Fc(tl, 0, "\t.backend = backends,\n"); + Fc(tl, 0, "\t.ndirector = %d,\n", tl->nbackend); + Fc(tl, 0, "\t.director = directors,\n"); Fc(tl, 0, "\t.ref = VGC_ref,\n"); Fc(tl, 0, "\t.nref = VGC_NREFS,\n"); Fc(tl, 0, "\t.nsrc = %u,\n", tl->nsources); Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-02-06 09:47:24 UTC (rev 2436) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-02-06 15:19:49 UTC (rev 2437) @@ -311,17 +311,18 @@ vsb_cat(sb, " */\n"); vsb_cat(sb, "\n"); vsb_cat(sb, "struct sess;\n"); + vsb_cat(sb, "struct cli;\n"); vsb_cat(sb, "\n"); - vsb_cat(sb, "typedef void vcl_init_f(void);\n"); - vsb_cat(sb, "typedef void vcl_fini_f(void);\n"); + vsb_cat(sb, "typedef void vcl_init_f(struct cli *);\n"); + vsb_cat(sb, "typedef void vcl_fini_f(struct cli *);\n"); vsb_cat(sb, "typedef int vcl_func_f(struct sess *sp);\n"); vsb_cat(sb, "\n"); vsb_cat(sb, "struct VCL_conf {\n"); vsb_cat(sb, " unsigned magic;\n"); vsb_cat(sb, "#define VCL_CONF_MAGIC 0x7406c509 /* from /dev/random */\n"); vsb_cat(sb, "\n"); - vsb_cat(sb, " struct backend **backend;\n"); - vsb_cat(sb, " unsigned nbackend;\n"); + vsb_cat(sb, " struct director **director;\n"); + vsb_cat(sb, " unsigned ndirector;\n"); vsb_cat(sb, " struct vrt_ref *ref;\n"); vsb_cat(sb, " unsigned nref;\n"); vsb_cat(sb, " unsigned busy;\n"); @@ -388,55 +389,51 @@ vsb_cat(sb, "\n"); vsb_cat(sb, "struct sess;\n"); vsb_cat(sb, "struct vsb;\n"); - vsb_cat(sb, "struct backend;\n"); + vsb_cat(sb, "struct cli;\n"); + vsb_cat(sb, "struct director;\n"); vsb_cat(sb, "struct VCL_conf;\n"); vsb_cat(sb, "struct sockaddr;\n"); vsb_cat(sb, "\n"); - vsb_cat(sb, "struct vrt_backend_host {\n"); + vsb_cat(sb, "/*\n"); + vsb_cat(sb, " * A backend is a host+port somewhere on the network\n"); + vsb_cat(sb, " */\n"); + vsb_cat(sb, "struct vrt_backend {\n"); vsb_cat(sb, " const char *portname;\n"); vsb_cat(sb, " const char *hostname;\n"); vsb_cat(sb, " const char *ident;\n"); vsb_cat(sb, "};\n"); vsb_cat(sb, "\n"); - vsb_cat(sb, "struct vrt_simple_backend {\n"); - vsb_cat(sb, " const char *ident;\n"); - vsb_cat(sb, " const char *name;\n"); - vsb_cat(sb, " const struct vrt_backend_host *host;\n"); - vsb_cat(sb, "};\n"); + vsb_cat(sb, "/*\n"); + vsb_cat(sb, " * A director with a predictable reply\n"); + vsb_cat(sb, " */\n"); vsb_cat(sb, "\n"); - vsb_cat(sb, "struct vrt_backend_entry {\n"); - vsb_cat(sb, " const char *port;\n"); - vsb_cat(sb, " const char *host;\n"); - vsb_cat(sb, " double weight;\n"); - vsb_cat(sb, " struct vrt_backend_entry *next;\n"); + vsb_cat(sb, "struct vrt_dir_simple {\n"); + vsb_cat(sb, " const char *ident;\n"); + vsb_cat(sb, " const char *name;\n"); + vsb_cat(sb, " const struct vrt_backend *host;\n"); vsb_cat(sb, "};\n"); vsb_cat(sb, "\n"); - vsb_cat(sb, "struct vrt_round_robin_backend {\n"); - vsb_cat(sb, " const char *name;\n"); - vsb_cat(sb, " unsigned count;\n"); - vsb_cat(sb, " struct vrt_backend_entry *bentry;\n"); - vsb_cat(sb, "};\n"); + vsb_cat(sb, "/*\n"); + vsb_cat(sb, " * A director with an unpredictable reply\n"); + vsb_cat(sb, " */\n"); vsb_cat(sb, "\n"); vsb_cat(sb, "struct vrt_dir_random_entry {\n"); - vsb_cat(sb, " const struct vrt_backend_host *host;\n"); - vsb_cat(sb, " double weight;\n"); + vsb_cat(sb, " const struct vrt_backend *host;\n"); + vsb_cat(sb, " double weight;\n"); vsb_cat(sb, "};\n"); vsb_cat(sb, "\n"); vsb_cat(sb, "struct vrt_dir_random {\n"); - vsb_cat(sb, " const char *ident;\n"); - vsb_cat(sb, " const char *name;\n"); - vsb_cat(sb, " unsigned nmember;\n"); + vsb_cat(sb, " const char *ident;\n"); + vsb_cat(sb, " const char *name;\n"); + vsb_cat(sb, " unsigned nmember;\n"); vsb_cat(sb, " const struct vrt_dir_random_entry *members;\n"); vsb_cat(sb, "};\n"); vsb_cat(sb, "\n"); - vsb_cat(sb, "struct vrt_random_backend {\n"); - vsb_cat(sb, " const char *name;\n"); - vsb_cat(sb, " unsigned weighted;\n"); - vsb_cat(sb, " unsigned count;\n"); - vsb_cat(sb, " struct vrt_backend_entry *bentry;\n"); - vsb_cat(sb, "};\n"); + vsb_cat(sb, "/*\n"); + vsb_cat(sb, " * other stuff.\n"); + vsb_cat(sb, " * XXX: document when bored\n"); + vsb_cat(sb, " */\n"); vsb_cat(sb, "\n"); - vsb_cat(sb, "\n"); vsb_cat(sb, "struct vrt_ref {\n"); vsb_cat(sb, " unsigned source;\n"); vsb_cat(sb, " unsigned offset;\n"); @@ -486,10 +483,9 @@ vsb_cat(sb, "void VRT_Rollback(struct sess *sp);\n"); vsb_cat(sb, "\n"); vsb_cat(sb, "/* Backend related */\n"); - vsb_cat(sb, "void VRT_init_simple_backend(struct backend **, const struct vrt_simple_backend *);\n"); - vsb_cat(sb, "void VRT_init_round_robin_backend(struct backend **, const struct vrt_round_robin_backend *);\n"); - vsb_cat(sb, "void VRT_init_random_backend(struct backend **, const struct vrt_dir_random *);\n"); - vsb_cat(sb, "void VRT_fini_backend(struct backend *);\n"); + vsb_cat(sb, "void VRT_init_dir_simple(struct cli *, struct director **, const struct vrt_dir_simple *);\n"); + vsb_cat(sb, "void VRT_init_dir_random(struct cli *, struct director **, const struct vrt_dir_random *);\n"); + vsb_cat(sb, "void VRT_fini_dir(struct cli *, struct director *);\n"); 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"); @@ -516,8 +512,8 @@ vsb_cat(sb, "const char * VRT_r_req_proto(const struct sess *);\n"); vsb_cat(sb, "void VRT_l_req_proto(const struct sess *, const char *, ...);\n"); vsb_cat(sb, "void VRT_l_req_hash(struct sess *, const char *);\n"); - vsb_cat(sb, "struct backend * VRT_r_req_backend(struct sess *);\n"); - vsb_cat(sb, "void VRT_l_req_backend(struct sess *, struct backend *);\n"); + vsb_cat(sb, "struct director * VRT_r_req_backend(struct sess *);\n"); + vsb_cat(sb, "void VRT_l_req_backend(struct sess *, struct director *);\n"); vsb_cat(sb, "int VRT_r_req_restarts(const struct sess *);\n"); vsb_cat(sb, "double VRT_r_req_grace(struct sess *);\n"); vsb_cat(sb, "void VRT_l_req_grace(struct sess *, double);\n"); Modified: trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl 2008-02-06 09:47:24 UTC (rev 2436) +++ trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl 2008-02-06 15:19:49 UTC (rev 2437) @@ -123,17 +123,18 @@ set fo [open ../../include/vcl.h w] warns $fo puts $fo {struct sess; +struct cli; -typedef void vcl_init_f(void); -typedef void vcl_fini_f(void); +typedef void vcl_init_f(struct cli *); +typedef void vcl_fini_f(struct cli *); typedef int vcl_func_f(struct sess *sp); } puts $fo "struct VCL_conf {" puts $fo { unsigned magic; #define VCL_CONF_MAGIC 0x7406c509 /* from /dev/random */ - struct backend **backend; - unsigned nbackend; + struct director **director; + unsigned ndirector; struct vrt_ref *ref; unsigned nref; unsigned busy; Modified: trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl 2008-02-06 09:47:24 UTC (rev 2436) +++ trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl 2008-02-06 15:19:49 UTC (rev 2437) @@ -211,7 +211,7 @@ set tt(IP) "struct sockaddr *" set tt(STRING) "const char *" set tt(BOOL) "unsigned" -set tt(BACKEND) "struct backend *" +set tt(BACKEND) "struct director *" set tt(TIME) "double" set tt(RTIME) "double" set tt(INT) "int" From des at projects.linpro.no Thu Feb 7 01:40:17 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Thu, 7 Feb 2008 02:40:17 +0100 (CET) Subject: r2438 - in trunk/varnish-cache: . bin/varnishd Message-ID: <20080207014017.795C11EC2B2@projects.linpro.no> Author: des Date: 2008-02-07 02:40:15 +0100 (Thu, 07 Feb 2008) New Revision: 2438 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/configure.ac Log: _islocked_np() was renamed to isowned_np() in FreeBSD. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-02-06 15:19:49 UTC (rev 2437) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-02-07 01:40:15 UTC (rev 2438) @@ -638,8 +638,8 @@ } while (0); #endif -#if defined(HAVE_PTHREAD_MUTEX_ISLOCKED_NP) -#define ALOCKED(mutex) AN(pthread_mutex_islocked_np((mutex))) +#if defined(HAVE_PTHREAD_MUTEX_ISOWNED_NP) +#define ALOCKED(mutex) AN(pthread_mutex_isowned_np((mutex))) #elif defined(DIAGNOSTICS) #define ALOCKED(mutex) AN(pthread_mutex_trylock((mutex))) #else Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2008-02-06 15:19:49 UTC (rev 2437) +++ trunk/varnish-cache/configure.ac 2008-02-07 01:40:15 UTC (rev 2438) @@ -104,7 +104,7 @@ save_LIBS="${LIBS}" LIBS="${PTHREAD_LIBS}" AC_CHECK_FUNCS([pthread_set_name_np]) -AC_CHECK_FUNCS([pthread_mutex_islocked_np]) +AC_CHECK_FUNCS([pthread_mutex_isowned_np]) LIBS="${save_LIBS}" ## This one is tricky, there are multiple versions From phk at projects.linpro.no Thu Feb 7 09:33:31 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 7 Feb 2008 10:33:31 +0100 (CET) Subject: r2439 - trunk/varnish-cache/bin/varnishd Message-ID: <20080207093331.340191EC2B1@projects.linpro.no> Author: phk Date: 2008-02-07 10:33:30 +0100 (Thu, 07 Feb 2008) New Revision: 2439 Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c Log: Use the correct ident (nuke the other one) and do only one dns lookup. Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend.c 2008-02-07 01:40:15 UTC (rev 2438) +++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2008-02-07 09:33:30 UTC (rev 2439) @@ -59,7 +59,6 @@ int refcount; pthread_mutex_t mtx; - const char *ident; struct addrinfo *ai; struct addrinfo *last_ai; @@ -519,7 +518,7 @@ ASSERT_CLI(); VTAILQ_FOREACH(b, &backendlist, list) { CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC); - if (strcmp(b->ident, vb->ident)) + if (strcmp(b->vrt->ident, vb->ident)) continue; b->refcount++; return (b); @@ -549,8 +548,6 @@ b->last_check = TIM_mono(); - vbe_dns_lookup(cli, b); - VTAILQ_INSERT_TAIL(&backendlist, b, list); return (b); } From phk at projects.linpro.no Thu Feb 7 09:52:28 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 7 Feb 2008 10:52:28 +0100 (CET) Subject: r2440 - in trunk/varnish-cache: include lib/libvcl Message-ID: <20080207095228.234EE1EC21B@projects.linpro.no> Author: phk Date: 2008-02-07 10:52:26 +0100 (Thu, 07 Feb 2008) New Revision: 2440 Modified: trunk/varnish-cache/include/vrt.h trunk/varnish-cache/lib/libvcl/vcc_backend.c trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c Log: Remove ident string from directors, they are not recycled. Add vcl_name to backend hosts. Simple backends get the obvious name. Directors inlined backend hosts gets the directors name with an array suffix, for instance "b1[1]". Modified: trunk/varnish-cache/include/vrt.h =================================================================== --- trunk/varnish-cache/include/vrt.h 2008-02-07 09:33:30 UTC (rev 2439) +++ trunk/varnish-cache/include/vrt.h 2008-02-07 09:52:26 UTC (rev 2440) @@ -47,6 +47,7 @@ struct vrt_backend { const char *portname; const char *hostname; + const char *vcl_name; const char *ident; }; @@ -55,7 +56,6 @@ */ struct vrt_dir_simple { - const char *ident; const char *name; const struct vrt_backend *host; }; @@ -70,7 +70,6 @@ }; struct vrt_dir_random { - const char *ident; const char *name; unsigned nmember; const struct vrt_dir_random_entry *members; Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-02-07 09:33:30 UTC (rev 2439) +++ trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-02-07 09:52:26 UTC (rev 2440) @@ -74,7 +74,7 @@ { vsb_printf(v, "\t.ident ="); - if (qual != NULL) { + if (serial != 0 && qual != NULL) { vsb_printf(v, "\n\t \"%.*s \"", PF(qual)); qual = VTAILQ_NEXT(qual, list); vsb_printf(v, "\n\t \"%.*s \"", PF(qual)); @@ -322,7 +322,10 @@ ExpectErr(tl, '}'); vcc_EmitBeIdent(tl->fh, qual, serial, t_first, tl->t); - Fh(tl, 0, "};\n"); + Fh(tl, 0, "\t.vcl_name = \"%.*s", PF(qual)); + if (serial) + Fh(tl, 0, "[%d]", serial); + Fh(tl, 0, "\"\n};\n"); vcc_NextToken(tl); } @@ -333,12 +336,10 @@ void vcc_ParseBackend(struct tokenlist *tl) { - struct token *t_first; struct host *h; int nbh; h = TlAlloc(tl, sizeof *h); - t_first = tl->t; /* T_BACKEND */ vcc_NextToken(tl); @@ -346,7 +347,7 @@ h->name = tl->t; vcc_NextToken(tl); - vcc_ParseBackendHost(tl, &nbh, NULL, 0); + vcc_ParseBackendHost(tl, &nbh, h->name, 0); ERRCHK(tl); h->hnum = nbh; @@ -367,7 +368,6 @@ PF(h->name)); Fc(tl, 0, "\t.name = \"%.*s\",\n", PF(h->name)); Fc(tl, 0, "\t.host = &bh_%d,\n", nbh); - vcc_EmitBeIdent(tl->fc, NULL, 0, t_first, tl->t); Fc(tl, 0, "};\n"); tl->nbackend++; @@ -378,7 +378,7 @@ */ static void -vcc_ParseRandomDirector(struct tokenlist *tl, const struct token *t_first, struct token *t_dir) +vcc_ParseRandomDirector(struct tokenlist *tl, struct token *t_dir) { struct token *t_field; int nbh, nelem; @@ -437,7 +437,6 @@ Fc(tl, 0, "\t.name = \"%.*s\",\n", PF(t_dir)); Fc(tl, 0, "\t.nmember = %d,\n", nelem); Fc(tl, 0, "\t.members = vdre_%.*s,\n", PF(t_dir)); - vcc_EmitBeIdent(tl->fc, NULL, 0, t_first, tl->t); Fc(tl, 0, "};\n"); vcc_NextToken(tl); Fi(tl, 0, @@ -464,7 +463,7 @@ ExpectErr(tl, ID); /* ID: policy */ if (vcc_IdIs(tl->t, "random")) - vcc_ParseRandomDirector(tl, t_first, t_dir); + vcc_ParseRandomDirector(tl, t_dir); else { vsb_printf(tl->sb, "Unknown director policy: "); vcc_ErrToken(tl, tl->t); Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-02-07 09:33:30 UTC (rev 2439) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-02-07 09:52:26 UTC (rev 2440) @@ -400,6 +400,7 @@ vsb_cat(sb, "struct vrt_backend {\n"); vsb_cat(sb, " const char *portname;\n"); vsb_cat(sb, " const char *hostname;\n"); + vsb_cat(sb, " const char *vcl_name;\n"); vsb_cat(sb, " const char *ident;\n"); vsb_cat(sb, "};\n"); vsb_cat(sb, "\n"); @@ -408,7 +409,6 @@ vsb_cat(sb, " */\n"); vsb_cat(sb, "\n"); vsb_cat(sb, "struct vrt_dir_simple {\n"); - vsb_cat(sb, " const char *ident;\n"); vsb_cat(sb, " const char *name;\n"); vsb_cat(sb, " const struct vrt_backend *host;\n"); vsb_cat(sb, "};\n"); @@ -423,7 +423,6 @@ vsb_cat(sb, "};\n"); vsb_cat(sb, "\n"); vsb_cat(sb, "struct vrt_dir_random {\n"); - vsb_cat(sb, " const char *ident;\n"); vsb_cat(sb, " const char *name;\n"); vsb_cat(sb, " unsigned nmember;\n"); vsb_cat(sb, " const struct vrt_dir_random_entry *members;\n"); From phk at projects.linpro.no Thu Feb 7 09:53:28 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 7 Feb 2008 10:53:28 +0100 (CET) Subject: r2441 - trunk/varnish-cache/bin/varnishd Message-ID: <20080207095328.BB8161EC2B1@projects.linpro.no> Author: phk Date: 2008-02-07 10:53:28 +0100 (Thu, 07 Feb 2008) New Revision: 2441 Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c Log: Emit the vcl_name from the backend host. Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend.c 2008-02-07 09:52:26 UTC (rev 2440) +++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2008-02-07 09:53:28 UTC (rev 2441) @@ -51,7 +51,6 @@ struct backend { unsigned magic; #define BACKEND_MAGIC 0x64c4c7c6 - char *vcl_name; struct vrt_backend vrt[1]; @@ -124,7 +123,7 @@ TCP_name((void*)&ss, alen, abuf2, sizeof abuf2, pbuf2, sizeof pbuf2); WSL(sp->wrk, SLT_BackendOpen, s, "%s %s %s %s %s", - sp->backend->vcl_name, abuf1, pbuf1, abuf2, pbuf2); + sp->backend->vrt->vcl_name, abuf1, pbuf1, abuf2, pbuf2); LOCK(&sp->backend->mtx); return (s); @@ -399,7 +398,7 @@ CHECK_OBJ_NOTNULL(vc->backend, BACKEND_MAGIC); b = vc->backend; assert(vc->fd >= 0); - WSL(w, SLT_BackendClose, vc->fd, "%s", vc->backend->vcl_name); + WSL(w, SLT_BackendClose, vc->fd, "%s", vc->backend->vrt->vcl_name); i = close(vc->fd); assert(i == 0 || errno == ECONNRESET || errno == ENOTCONN); vc->fd = -1; @@ -420,7 +419,7 @@ CHECK_OBJ_NOTNULL(vc->backend, BACKEND_MAGIC); assert(vc->fd >= 0); bp = vc->backend; - WSL(w, SLT_BackendReuse, vc->fd, "%s", vc->backend->vcl_name); + WSL(w, SLT_BackendReuse, vc->fd, "%s", vc->backend->vrt->vcl_name); LOCK(&vc->backend->mtx); VSL_stats->backend_recycle++; VTAILQ_INSERT_HEAD(&bp->connlist, vc, list); @@ -540,6 +539,8 @@ XXXAN(b->vrt->hostname); b->vrt->portname = strdup(vb->portname); XXXAN(b->vrt->portname); + b->vrt->vcl_name = strdup(vb->vcl_name); + XXXAN(b->vrt->vcl_name); MTX_INIT(&b->mtx); b->refcount = 1; From phk at projects.linpro.no Thu Feb 7 09:54:44 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 7 Feb 2008 10:54:44 +0100 (CET) Subject: r2442 - trunk/varnish-cache/bin/varnishd Message-ID: <20080207095444.91F3C1EC21B@projects.linpro.no> Author: phk Date: 2008-02-07 10:54:42 +0100 (Thu, 07 Feb 2008) New Revision: 2442 Added: trunk/varnish-cache/bin/varnishd/cache_dir_random.c Removed: trunk/varnish-cache/bin/varnishd/cache_backend_random.c trunk/varnish-cache/bin/varnishd/cache_backend_round_robin.c trunk/varnish-cache/bin/varnishd/cache_backend_simple.c Modified: trunk/varnish-cache/bin/varnishd/Makefile.am Log: Make the random director work, and remove the old code. Modified: trunk/varnish-cache/bin/varnishd/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishd/Makefile.am 2008-02-07 09:53:28 UTC (rev 2441) +++ trunk/varnish-cache/bin/varnishd/Makefile.am 2008-02-07 09:54:42 UTC (rev 2442) @@ -12,12 +12,10 @@ cache_acceptor_poll.c \ cache_acceptor_kqueue.c \ cache_backend.c \ - cache_backend_random.c \ - cache_backend_round_robin.c \ - cache_backend_simple.c \ cache_ban.c \ cache_center.c \ cache_cli.c \ + cache_dir_random.c \ cache_dir_simple.c \ cache_expire.c \ cache_fetch.c \ Deleted: trunk/varnish-cache/bin/varnishd/cache_backend_random.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend_random.c 2008-02-07 09:53:28 UTC (rev 2441) +++ trunk/varnish-cache/bin/varnishd/cache_backend_random.c 2008-02-07 09:54:42 UTC (rev 2442) @@ -1,530 +0,0 @@ -/*- - * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2008 Linpro AS - * All rights reserved. - * - * Author: Cecilie Fritzvold - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id$ - * - */ - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "shmlog.h" -#include "cache.h" -#include "vrt.h" - - -#if 0 -struct ber { - unsigned magic; -#define BER_MAGIC 0x645b03f4 - struct brspec *blist; - int count; -#if 0 - /* Store a hash of the backend info given in - * vcl for comparison when a new vcl file is - * uploaded. Not in use yet. - */ - unsigned hash; -#endif -}; - -struct brspec { - unsigned magic; -#define BRSPEC_MAGIC 0x5aa072a7 - struct brspec *next; - double limit; - char *hostname; - char *portname; - struct addrinfo *addr; - struct addrinfo *last_addr; - double dnsttl; - double dnstime; - unsigned dnsseq; - VTAILQ_HEAD(, vbe_conn) connlist; - int health; -}; - -/*-------------------------------------------------------------------- - * Try to get a socket connected to one of the addresses on the list. - * We start from the cached "last good" address and try all items on - * the list exactly once. - * If a new DNS lookup is made while we try, we start over and try the - * new list exactly once. - */ - -static int -ber_conn_try_list(const struct sess *sp, struct brspec *bs) -{ - struct addrinfo *ai, *from; - int s, loops; - unsigned myseq; - - CHECK_OBJ_NOTNULL(bs, BRSPEC_MAGIC); - if (bs->addr == NULL) - return (-1); - AN(bs->last_addr); - - /* Called with lock held */ - myseq = bs->dnsseq; - loops = 0; - ai = from = bs->last_addr; - while (1) { - - /* NB: releases/acquires lock */ - s = VBE_TryConnect(sp, ai); - - if (s >= 0) { - /* Update cached "last good" if still valid */ - if (myseq == bs->dnsseq) - bs->last_addr = ai; - return (s); - } - - if (myseq != bs->dnsseq) { - /* A DNS-lookup happended, try again from start */ - loops = 0; - from = bs->last_addr; - ai = from; - } else { - /* Try next one */ - ai = ai->ai_next; - if (ai == NULL) { - loops++; - ai = bs->addr; - } - } - if (loops == 1 && ai == from) - return (-1); - } -} - -/*--------------------------------------------------------------------*/ - -static const char * -ber_dns_lookup(struct backend *bp, struct brspec *bs) -{ - struct addrinfo *res, hint, *old; - int error; - - CHECK_OBJ_NOTNULL(bp, BACKEND_MAGIC); - CHECK_OBJ_NOTNULL(bs, BRSPEC_MAGIC); - - bs->dnstime = TIM_mono(); - - /* Let go of lock while we do sleepable stuff */ - UNLOCK(&bp->mtx); - - memset(&hint, 0, sizeof hint); - hint.ai_family = PF_UNSPEC; - hint.ai_socktype = SOCK_STREAM; - res = NULL; - error = getaddrinfo(bs->hostname, - bs->portname == NULL ? "http" : bs->portname, - &hint, &res); - LOCK(&bp->mtx); - if (error) { - if (res != NULL) - freeaddrinfo(res); - return(gai_strerror(error)); - } - bs->dnsseq++; - old = bs->addr; - bs->last_addr = res; - bs->addr = res; - if (old != NULL) - freeaddrinfo(old); - return (NULL); -} - -/*--------------------------------------------------------------------*/ - -static int -ber_conn_try(const struct sess *sp, struct backend *bp, struct brspec *bs) -{ - int s; - - LOCK(&bp->mtx); - - s = ber_conn_try_list(sp, bs); - if (s >= 0) { - bp->refcount++; - UNLOCK(&bp->mtx); - return (s); - } - - if (bs->dnstime + bs->dnsttl >= TIM_mono()) { - UNLOCK(&bp->mtx); - return (-1); - } - - (void)ber_dns_lookup(bp, bs); - - /* And try the entire list */ - s = ber_conn_try_list(sp, bs); - if (s >= 0) { - bp->refcount++; - UNLOCK(&bp->mtx); - return (s); - } - - UNLOCK(&bp->mtx); - return (-1); - -} - - -/* Get a backend connection ------------------------------------------ - * - * Get the next backend in the round-robin list, and connect to this. - * - * Try all cached backend connections for this backend, and use the - * first one that is looks like it is still connected. - * If that fails to get us a connection, create a new one, reusing a - * connection from the freelist, if possible. - * - * This function is slightly complicated by optimizations on bermtx. - */ - -static struct vbe_conn * -ber_nextfd(const struct sess *sp) -{ - struct vbe_conn *vc; - struct backend *bp; - int reuse = 0; - struct ber *ber; - struct brspec *bs; - int min_health = -10; - int num = 0; - double r = 0; - - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - CHECK_OBJ_NOTNULL(sp->backend, BACKEND_MAGIC); - bp = sp->backend; - CAST_OBJ_NOTNULL(ber, bp->priv, BER_MAGIC); - - r = (double)rand() / ((double)(RAND_MAX)+1.0); - bs = ber->blist; - CHECK_OBJ_NOTNULL(bs, BRSPEC_MAGIC); - while (r > bs->limit) { - bs = bs->next; - CHECK_OBJ_NOTNULL(bs, BRSPEC_MAGIC); - } - - /* If health is low (bad), use round-robin to find - * a server with better health (if possible). - */ - while (bs->health < min_health) { - bs = bs->next; - num++; - if (num > ber->count) { - min_health *= 10; - num = 0; - } - } - - while (1) { - LOCK(&bp->mtx); - vc = VTAILQ_FIRST(&bs->connlist); - if (vc != NULL) { - bp->refcount++; - assert(vc->backend == bp); - assert(vc->fd >= 0); - VTAILQ_REMOVE(&bs->connlist, vc, list); - } - UNLOCK(&bp->mtx); - if (vc == NULL) - break; - - if (VBE_CheckFd(vc->fd)) { - /* XXX locking of stats */ - VSL_stats->backend_reuse += reuse; - VSL_stats->backend_conn++; - return (vc); - } - VBE_ClosedFd(sp->wrk, vc); - } - - vc = VBE_NewConn(); - assert(vc->fd == -1); - AZ(vc->backend); - vc->fd = ber_conn_try(sp, bp, bs); - if (vc->fd < 0) { - VBE_ReleaseConn(vc); - VSL_stats->backend_fail++; - return (NULL); - } - vc->backend = bp; - vc->priv = bs; - VSL_stats->backend_conn++; - return (vc); - -} - -static struct vbe_conn * -ber_GetFd(const struct sess *sp) -{ - struct vbe_conn *vc; - unsigned n; - for (n = 1; n < 5; n++) { - vc = ber_nextfd(sp); - if (vc == NULL) { - AZ(usleep(100000 * n)); - continue; - } - assert(vc->fd >= 0); - assert(vc->backend == sp->backend); - WSL(sp->wrk, SLT_BackendXID, vc->fd, "%u", sp->xid); - WSP(sp, SLT_Backend, "%d %s", vc->fd, sp->backend->vcl_name); - return (vc); - } - return (NULL); -} - -/*--------------------------------------------------------------------*/ - -static void -ber_ClosedFd(struct worker *w, struct vbe_conn *vc) -{ - CHECK_OBJ_NOTNULL(vc, VBE_CONN_MAGIC); - CHECK_OBJ_NOTNULL(vc->backend, BACKEND_MAGIC); - assert(vc->fd >= 0); - WSL(w, SLT_BackendClose, vc->fd, "%s", vc->backend->vcl_name); - AZ(close(vc->fd)); - vc->fd = -1; - VBE_DropRef(vc->backend); - vc->backend = NULL; - VBE_ReleaseConn(vc); -} - -/*--------------------------------------------------------------------*/ - -static void -ber_RecycleFd(struct worker *w, struct vbe_conn *vc) -{ - struct brspec *bs; - - CHECK_OBJ_NOTNULL(vc, VBE_CONN_MAGIC); - CHECK_OBJ_NOTNULL(vc->backend, BACKEND_MAGIC); - CAST_OBJ_NOTNULL(bs, vc->priv, BRSPEC_MAGIC); - - assert(vc->fd >= 0); - WSL(w, SLT_BackendReuse, vc->fd, "%s", vc->backend->vcl_name); - LOCK(&vc->backend->mtx); - VSL_stats->backend_recycle++; - VTAILQ_INSERT_HEAD(&bs->connlist, vc, list); - VBE_DropRefLocked(vc->backend); -} - -/*--------------------------------------------------------------------*/ - -static void -ber_Cleanup(const struct backend *b) -{ - struct ber *ber; - struct vbe_conn *vbe; - struct brspec *bs, *bstmp; - - assert(b->refcount == 0); - CAST_OBJ_NOTNULL(ber, b->priv, BER_MAGIC); - - bs = ber->blist; - - do { - free(bs->portname); - free(bs->hostname); - freeaddrinfo(bs->addr); - while (1) { - vbe = VTAILQ_FIRST(&bs->connlist); - if (vbe == NULL) - break; - VTAILQ_REMOVE(&bs->connlist, vbe, list); - if (vbe->fd >= 0) - AZ(close(vbe->fd)); - free(vbe); - } - bstmp = bs; - bs = bs->next; - free(bstmp); - } while (bs != ber->blist); - - free(ber); -} - -/*--------------------------------------------------------------------*/ - -/* Will return the hostname of the first backend in the list */ -static const char * -ber_GetHostname(const struct backend *b) -{ - struct ber *ber; - - CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC); - CAST_OBJ_NOTNULL(ber, b->priv, BER_MAGIC); - return (ber->blist->hostname); -} - -/*--------------------------------------------------------------------*/ - -/* This should maybe be divided into two separate functions. One for - * increasing/decreasing health, and one for "pulling" the health - * towards neutral (0) as time passes - */ -static void -ber_UpdateHealth(const struct sess *sp, const struct vbe_conn *vc, int add) -{ - struct brspec *bs, *first; - struct ber *ber; - - if (vc != NULL) { - CAST_OBJ_NOTNULL(bs, vc->priv, BRSPEC_MAGIC); - - if (bs->health + add >= -10000 || bs->health + add <= 10000) - bs->health += add; - } else { - CAST_OBJ_NOTNULL(ber, sp->backend->priv, BRSPEC_MAGIC); - first = ber->blist; - bs = first; - do { - bs = bs->next; - bs->health = (int)((double)bs->health / 2); - } while (bs != first); - } -} - -/*--------------------------------------------------------------------*/ - -struct backend_method backend_method_random = { - .name = "random", - .getfd = ber_GetFd, - .close = ber_ClosedFd, - .recycle = ber_RecycleFd, - .gethostname = ber_GetHostname, - .updatehealth = ber_UpdateHealth, - .cleanup = ber_Cleanup, -}; - -#endif - -/*--------------------------------------------------------------------*/ - -void -VRT_init_dir_random(struct cli *cli, struct director **bp, const struct vrt_dir_random *t) -{ - (void)cli; - (void)bp; - (void)t; - - -#if 0 - struct backend *b; - - if (VBE_AddBackend(&backend_method_random, t->ident, bp)) - return; /* reuse existing backend */ - - bp = *bp; - AN(t->name); - REPLACE(b->vcl_name, t->name); - struct backend *b; - struct ber *ber; - struct vrt_backend_entry *be; - struct brspec *bs = NULL; - struct brspec *bs_prev = NULL; - struct brspec *bs_first = NULL; - double limit = 0; - double default_weight; - - /* - * Scan existing backends to see if we can recycle one of them. - */ - - /* - * XXX: Do this by comparing a hash generated from this new - * XXX: backend with the earlier computed hashes from existing - * XXX: backends ? Should the hash be a parameter to this function, - * XXX: or computed here? - */ - - b = VBE_NewBackend(&backend_method_random); - - ber = calloc(sizeof *ber, 1); - XXXAN(ber); - ber->magic = BER_MAGIC; - ber->count = t->count; - - b->priv = ber; - - AN(t->name); - b->vcl_name = strdup(t->name); - XXXAN(b->vcl_name); - - default_weight = 1.0 / (double)t->count; - - be = t->bentry; - while (be != NULL) { - bs = calloc(sizeof *bs, 1); - XXXAN(bs); - bs->magic = BRSPEC_MAGIC; - AN(be->port); - bs->portname = strdup(be->port); - XXXAN(bs->portname); - - AN(be->host); - bs->hostname = strdup(be->host); - XXXAN(bs->hostname); - - if (!(t->weighted)) - be->weight = default_weight; - - limit += be->weight; - bs->limit = limit; - - bs->dnsttl = 300; - bs->health = 0; - - if (bs_first == NULL) - bs_first = bs; - - bs->next = bs_prev; - bs_prev = bs; - be = be->next; - } - XXXAN(bs_first); - bs_first->next = bs; - ber->blist = bs; - - *bp = b; -#endif -} - Deleted: trunk/varnish-cache/bin/varnishd/cache_backend_round_robin.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend_round_robin.c 2008-02-07 09:53:28 UTC (rev 2441) +++ trunk/varnish-cache/bin/varnishd/cache_backend_round_robin.c 2008-02-07 09:54:42 UTC (rev 2442) @@ -1,492 +0,0 @@ -/*- - * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2008 Linpro AS - * All rights reserved. - * - * Author: Cecilie Fritzvold - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id$ - * - */ - -#if 0 - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "shmlog.h" -#include "cache.h" -#include "vrt.h" - - -struct brr { - unsigned magic; -#define BRR_MAGIC 0x66f05894 - struct bspec *blist; - int count; -#if 0 - /* Store a hash of the backend info given in - * vcl for comparison when a new vcl file is - * uploaded. Not in use yet. - */ - unsigned hash; -#endif -}; - -struct bspec { - unsigned magic; -#define BSPEC_MAGIC 0x761d69c2 - struct bspec *next; - char *hostname; - char *portname; - struct addrinfo *addr; - struct addrinfo *last_addr; - double dnsttl; - double dnstime; - unsigned dnsseq; - VTAILQ_HEAD(, vbe_conn) connlist; - int health; -}; - -/*-------------------------------------------------------------------- - * Try to get a socket connected to one of the addresses on the list. - * We start from the cached "last good" address and try all items on - * the list exactly once. - * If a new DNS lookup is made while we try, we start over and try the - * new list exactly once. - */ - -static int -brr_conn_try_list(const struct sess *sp, struct bspec *bs) -{ - struct addrinfo *ai, *from; - int s, loops; - unsigned myseq; - - CHECK_OBJ_NOTNULL(bs, BSPEC_MAGIC); - if (bs->addr == NULL) - return (-1); - AN(bs->last_addr); - - /* Called with lock held */ - myseq = bs->dnsseq; - loops = 0; - ai = from = bs->last_addr; - while (1) { - - /* NB: releases/acquires lock */ - s = VBE_TryConnect(sp, ai); - - if (s >= 0) { - /* Update cached "last good" if still valid */ - if (myseq == bs->dnsseq) - bs->last_addr = ai; - return (s); - } - - if (myseq != bs->dnsseq) { - /* A DNS-lookup happended, try again from start */ - loops = 0; - from = bs->last_addr; - ai = from; - } else { - /* Try next one */ - ai = ai->ai_next; - if (ai == NULL) { - loops++; - ai = bs->addr; - } - } - if (loops == 1 && ai == from) - return (-1); - } -} - -/*--------------------------------------------------------------------*/ - -static const char * -brr_dns_lookup(struct backend *bp, struct bspec *bs) -{ - struct addrinfo *res, hint, *old; - int error; - - CHECK_OBJ_NOTNULL(bp, BACKEND_MAGIC); - CHECK_OBJ_NOTNULL(bs, BSPEC_MAGIC); - - bs->dnstime = TIM_mono(); - - /* Let go of lock while we do sleepable stuff */ - UNLOCK(&bp->mtx); - - memset(&hint, 0, sizeof hint); - hint.ai_family = PF_UNSPEC; - hint.ai_socktype = SOCK_STREAM; - res = NULL; - error = getaddrinfo(bs->hostname, - bs->portname == NULL ? "http" : bs->portname, - &hint, &res); - LOCK(&bp->mtx); - if (error) { - if (res != NULL) - freeaddrinfo(res); - return(gai_strerror(error)); - } - bs->dnsseq++; - old = bs->addr; - bs->last_addr = res; - bs->addr = res; - if (old != NULL) - freeaddrinfo(old); - return (NULL); -} - -/*--------------------------------------------------------------------*/ - -static int -brr_conn_try(const struct sess *sp, struct backend *bp, struct bspec *bs) -{ - int s; - - LOCK(&bp->mtx); - - s = brr_conn_try_list(sp, bs); - if (s >= 0) { - bp->refcount++; - UNLOCK(&bp->mtx); - return (s); - } - - if (bs->dnstime + bs->dnsttl >= TIM_mono()) { - UNLOCK(&bp->mtx); - return (-1); - } - - (void)brr_dns_lookup(bp, bs); - - /* And try the entire list */ - s = brr_conn_try_list(sp, bs); - if (s >= 0) { - bp->refcount++; - UNLOCK(&bp->mtx); - return (s); - } - - UNLOCK(&bp->mtx); - return (-1); -} - - -/* Get a backend connection ------------------------------------------ - * - * Get the next backend in the round-robin list, and connect to this. - * - * Try all cached backend connections for this backend, and use the - * first one that is looks like it is still connected. - * If that fails to get us a connection, create a new one, reusing a - * connection from the freelist, if possible. - * - * This function is slightly complicated by optimizations on brrmtx. - */ - -static struct vbe_conn * -brr_nextfd(const struct sess *sp) -{ - struct vbe_conn *vc; - struct backend *bp; - int reuse = 0; - struct brr *brr; - struct bspec *bs; - int min_health = -10; - int num = 0; - - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - CHECK_OBJ_NOTNULL(sp->backend, BACKEND_MAGIC); - bp = sp->backend; - CAST_OBJ_NOTNULL(brr, bp->priv, BRR_MAGIC); - - do { - bs = brr->blist = brr->blist->next; - num++; - if (num > brr->count) { - min_health *= 10; - num = 0; - } - } while (bs->health < min_health); - - while (1) { - LOCK(&bp->mtx); - vc = VTAILQ_FIRST(&bs->connlist); - if (vc != NULL) { - bp->refcount++; - assert(vc->backend == bp); - assert(vc->fd >= 0); - VTAILQ_REMOVE(&bs->connlist, vc, list); - } - UNLOCK(&bp->mtx); - if (vc == NULL) - break; - - if (VBE_CheckFd(vc->fd)) { - /* XXX locking of stats */ - VSL_stats->backend_reuse += reuse; - VSL_stats->backend_conn++; - return (vc); - } - VBE_ClosedFd(sp->wrk, vc); - } - - vc = VBE_NewConn(); - assert(vc->fd == -1); - AZ(vc->backend); - vc->fd = brr_conn_try(sp, bp, bs); - if (vc->fd < 0) { - VBE_ReleaseConn(vc); - VSL_stats->backend_fail++; - return (NULL); - } - vc->backend = bp; - vc->priv = bs; - VSL_stats->backend_conn++; - return (vc); -} - -static struct vbe_conn * -brr_GetFd(const struct sess *sp) -{ - struct vbe_conn *vc; - unsigned n; - for (n = 1; n < 5; n++) { - vc = brr_nextfd(sp); - if (vc == NULL) { - AZ(usleep(100000 * n)); - continue; - } - assert(vc->fd >= 0); - assert(vc->backend == sp->backend); - WSL(sp->wrk, SLT_BackendXID, vc->fd, "%u", sp->xid); - WSP(sp, SLT_Backend, "%d %s", vc->fd, sp->backend->vcl_name); - return (vc); - } - return (NULL); -} - -/*--------------------------------------------------------------------*/ - -static void -brr_ClosedFd(struct worker *w, struct vbe_conn *vc) -{ - CHECK_OBJ_NOTNULL(vc, VBE_CONN_MAGIC); - CHECK_OBJ_NOTNULL(vc->backend, BACKEND_MAGIC); - assert(vc->fd >= 0); - WSL(w, SLT_BackendClose, vc->fd, "%s", vc->backend->vcl_name); - AZ(close(vc->fd)); - vc->fd = -1; - VBE_DropRef(vc->backend); - vc->backend = NULL; - VBE_ReleaseConn(vc); -} - -/*--------------------------------------------------------------------*/ - -static void -brr_RecycleFd(struct worker *w, struct vbe_conn *vc) -{ - struct bspec *bs; - - CHECK_OBJ_NOTNULL(vc, VBE_CONN_MAGIC); - CHECK_OBJ_NOTNULL(vc->backend, BACKEND_MAGIC); - CAST_OBJ_NOTNULL(bs, vc->priv, BSPEC_MAGIC); - - assert(vc->fd >= 0); - WSL(w, SLT_BackendReuse, vc->fd, "%s", vc->backend->vcl_name); - LOCK(&vc->backend->mtx); - VSL_stats->backend_recycle++; - VTAILQ_INSERT_HEAD(&bs->connlist, vc, list); - VBE_DropRefLocked(vc->backend); -} - -/*--------------------------------------------------------------------*/ - -static void -brr_Cleanup(const struct backend *b) -{ - struct brr *brr; - struct vbe_conn *vbe; - struct bspec *bs, *bstmp; - - assert(b->refcount == 0); - CAST_OBJ_NOTNULL(brr, b->priv, BRR_MAGIC); - - bs = brr->blist; - - do { - free(bs->portname); - free(bs->hostname); - freeaddrinfo(bs->addr); - while (1) { - vbe = VTAILQ_FIRST(&bs->connlist); - if (vbe == NULL) - break; - VTAILQ_REMOVE(&bs->connlist, vbe, list); - if (vbe->fd >= 0) - AZ(close(vbe->fd)); - free(vbe); - } - bstmp = bs; - bs = bs->next; - free(bstmp); - } while (bs != brr->blist); - - free(brr); -} - -/*--------------------------------------------------------------------*/ - -/* Will return the hostname of the first backend in the list */ -static const char * -brr_GetHostname(const struct backend *b) -{ - struct brr *brr; - - CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC); - CAST_OBJ_NOTNULL(brr, b->priv, BRR_MAGIC); - return (brr->blist->hostname); -} - -/*--------------------------------------------------------------------*/ - -/* This should maybe be divided into two separate functions. One for - * increasing/decreasing health, and one for "pulling" the health - * towards neutral (0) as time passes - */ -static void -brr_UpdateHealth(const struct sess *sp, const struct vbe_conn *vc, int add) -{ - struct bspec *bs, *first; - struct brr *brr; - - if (vc != NULL) { - - CAST_OBJ_NOTNULL(bs, vc->priv, BSPEC_MAGIC); - - if (bs->health + add >= -10000 || bs->health + add <= 10000) - bs->health += add; - } else { - CAST_OBJ_NOTNULL(brr, sp->backend->priv, BSPEC_MAGIC); - first = brr->blist; - bs = first; - do { - bs = bs->next; - bs->health = (int)((double)bs->health / 2); - } while (bs != first); - } -} - -/*--------------------------------------------------------------------*/ - -struct backend_method backend_method_round_robin = { - .name = "round_robin", - .getfd = brr_GetFd, - .close = brr_ClosedFd, - .recycle = brr_RecycleFd, - .gethostname = brr_GetHostname, - .updatehealth = brr_UpdateHealth, - .cleanup = brr_Cleanup, -}; - -/*--------------------------------------------------------------------*/ - -void -VRT_init_round_robin_backend(struct backend **bp, const struct vrt_round_robin_backend *t) -{ - struct backend *b; - struct brr *brr; - struct vrt_backend_entry *be; - struct bspec *bs = NULL; - struct bspec *bs_prev = NULL; - struct bspec *bs_first = NULL; - - /* - * Scan existing backends to see if we can recycle one of them. - */ - /* - * XXX: Do this by comparing a hash generated from this new - * XXX: backend with the earlier computed hashes from existing - * XXX: backends ? Should the hash be a parameter to this function, - * XXX: or computed here? - */ - - - b = VBE_NewBackend(&backend_method_round_robin); - - brr = calloc(sizeof *brr, 1); - XXXAN(brr); - brr->magic = BRR_MAGIC; - brr->count = t->count; - - b->priv = brr; - - AN(t->name); - b->vcl_name = strdup(t->name); - XXXAN(b->vcl_name); - - be = t->bentry; - while (be != NULL) { - bs = calloc(sizeof *bs, 1); - XXXAN(bs); - bs->magic = BSPEC_MAGIC; - AN(be->port); - bs->portname = strdup(be->port); - XXXAN(bs->portname); - - AN(be->host); - bs->hostname = strdup(be->host); - XXXAN(bs->hostname); - - bs->dnsttl = 300; - bs->health = 0; - - if (bs_first == NULL) - bs_first = bs; - - bs->next = bs_prev; - bs_prev = bs; - be = be->next; - } - - XXXAN(bs_first); - bs_first->next = bs; - brr->blist = bs; - - *bp = b; -} - -#endif Deleted: trunk/varnish-cache/bin/varnishd/cache_backend_simple.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend_simple.c 2008-02-07 09:53:28 UTC (rev 2441) +++ trunk/varnish-cache/bin/varnishd/cache_backend_simple.c 2008-02-07 09:54:42 UTC (rev 2442) @@ -1,349 +0,0 @@ -/*- - * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2008 Linpro AS - * All rights reserved. - * - * Author: Poul-Henning Kamp - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id$ - * - */ - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "shmlog.h" -#include "cache.h" -#include "vrt.h" - -#if 0 - -struct bes { - unsigned magic; -#define BES_MAGIC 0x015e17ac - char *hostname; - char *portname; - struct addrinfo *addr; - struct addrinfo *last_addr; - double dnsttl; - double dnstime; - unsigned dnsseq; - VTAILQ_HEAD(, vbe_conn) connlist; -}; - -/*-------------------------------------------------------------------- - * Try to get a socket connected to one of the addresses on the list. - * We start from the cached "last good" address and try all items on - * the list exactly once. - * If a new DNS lookup is made while we try, we start over and try the - * new list exactly once. - */ - -static int -bes_conn_try_list(const struct sess *sp, struct bes *bes) -{ - struct addrinfo *ai, *from; - int s, loops; - unsigned myseq; - - CHECK_OBJ_NOTNULL(bes, BES_MAGIC); - if (bes->addr == NULL) - return (-1); - AN(bes->last_addr); - - /* Called with lock held */ - myseq = bes->dnsseq; - loops = 0; - ai = from = bes->last_addr; - while (1) { - - /* NB: releases/acquires lock */ - s = VBE_TryConnect(sp, ai); - - if (s >= 0) { - /* Update cached "last good" if still valid */ - if (myseq == bes->dnsseq) - bes->last_addr = ai; - return (s); - } - - if (myseq != bes->dnsseq) { - /* A DNS-lookup happended, try again from start */ - loops = 0; - from = bes->last_addr; - ai = from; - } else { - /* Try next one */ - ai = ai->ai_next; - if (ai == NULL) { - loops++; - ai = bes->addr; - } - } - if (loops == 1 && ai == from) - return (-1); - } -} - -/*--------------------------------------------------------------------*/ - -static const char * -bes_dns_lookup(struct backend *bp) -{ - struct addrinfo *res, hint, *old; - struct bes *bes; - int error; - - CHECK_OBJ_NOTNULL(bp, BACKEND_MAGIC); - CAST_OBJ_NOTNULL(bes, bp->priv, BES_MAGIC); - - bes->dnstime = TIM_mono(); - - /* Let go of lock while we do sleepable stuff */ - UNLOCK(&bp->mtx); - - memset(&hint, 0, sizeof hint); - hint.ai_family = PF_UNSPEC; - hint.ai_socktype = SOCK_STREAM; - res = NULL; - error = getaddrinfo(bes->hostname, - bes->portname == NULL ? "http" : bes->portname, - &hint, &res); - LOCK(&bp->mtx); - if (error) { - if (res != NULL) - freeaddrinfo(res); - return(gai_strerror(error)); - } - bes->dnsseq++; - old = bes->addr; - bes->last_addr = res; - bes->addr = res; - if (old != NULL) - freeaddrinfo(old); - return (NULL); -} - -/*--------------------------------------------------------------------*/ - -static int -bes_conn_try(const struct sess *sp, struct backend *bp) -{ - int s; - struct bes *bes; - - CAST_OBJ_NOTNULL(bes, bp->priv, BES_MAGIC); - - LOCK(&bp->mtx); - - s = bes_conn_try_list(sp, bes); - if (s >= 0) { - bp->refcount++; - UNLOCK(&bp->mtx); - return (s); - } - - if (bes->dnstime + bes->dnsttl >= TIM_mono()) { - UNLOCK(&bp->mtx); - return (-1); - } - - (void)bes_dns_lookup(bp); - - /* And try the entire list */ - s = bes_conn_try_list(sp, bes); - if (s >= 0) { - bp->refcount++; - UNLOCK(&bp->mtx); - return (s); - } - - UNLOCK(&bp->mtx); - return (-1); -} - -/* Get a backend connection ------------------------------------------ - * - * Try all cached backend connections for this backend, and use the - * first one that is looks like it is still connected. - * If that fails to get us a connection, create a new one, reusing a - * connection from the freelist, if possible. - * - * This function is slightly complicated by optimizations on besmtx. - */ - -static struct vbe_conn * -bes_nextfd(const struct sess *sp) -{ - struct vbe_conn *vc; - struct backend *bp; - int reuse = 0; - struct bes *bes; - - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - CHECK_OBJ_NOTNULL(sp->backend, BACKEND_MAGIC); - bp = sp->backend; - CAST_OBJ_NOTNULL(bes, bp->priv, BES_MAGIC); - while (1) { - LOCK(&bp->mtx); - vc = VTAILQ_FIRST(&bes->connlist); - if (vc != NULL) { - bp->refcount++; - assert(vc->backend == bp); - assert(vc->fd >= 0); - VTAILQ_REMOVE(&bes->connlist, vc, list); - } - UNLOCK(&bp->mtx); - if (vc == NULL) - break; - - if (VBE_CheckFd(vc->fd)) { - /* XXX locking of stats */ - VSL_stats->backend_reuse += reuse; - VSL_stats->backend_conn++; - return (vc); - } - VBE_ClosedFd(sp->wrk, vc); - } - - vc = VBE_NewConn(); - assert(vc->fd == -1); - AZ(vc->backend); - vc->fd = bes_conn_try(sp, bp); - if (vc->fd < 0) { - VBE_ReleaseConn(vc); - VSL_stats->backend_fail++; - return (NULL); - } - vc->backend = bp; - VSL_stats->backend_conn++; - return (vc); -} - -/*--------------------------------------------------------------------*/ - -static struct vbe_conn * -bes_GetFd(const struct sess *sp) -{ - struct vbe_conn *vc; - unsigned n; - for (n = 1; n < 5; n++) { - vc = bes_nextfd(sp); - if (vc == NULL) { - AZ(usleep(100000 * n)); - continue; - } - assert(vc->fd >= 0); - assert(vc->backend == sp->backend); - WSL(sp->wrk, SLT_BackendXID, vc->fd, "%u", sp->xid); - WSP(sp, SLT_Backend, "%d %s", vc->fd, sp->backend->vcl_name); - return (vc); - } - return (NULL); -} - -/* Close a connection ------------------------------------------------*/ - -static void -bes_ClosedFd(struct worker *w, struct vbe_conn *vc) -{ - int i; - - CHECK_OBJ_NOTNULL(vc, VBE_CONN_MAGIC); - CHECK_OBJ_NOTNULL(vc->backend, BACKEND_MAGIC); - assert(vc->fd >= 0); - WSL(w, SLT_BackendClose, vc->fd, "%s", vc->backend->vcl_name); - i = close(vc->fd); - assert(i == 0 || errno == ECONNRESET || errno == ENOTCONN); - vc->fd = -1; - VBE_DropRef(vc->backend); - vc->backend = NULL; - VBE_ReleaseConn(vc); -} - -/* Recycle a connection ----------------------------------------------*/ - -static void -bes_RecycleFd(struct worker *w, struct vbe_conn *vc) -{ - struct bes *bes; - - CHECK_OBJ_NOTNULL(vc, VBE_CONN_MAGIC); - CHECK_OBJ_NOTNULL(vc->backend, BACKEND_MAGIC); - CAST_OBJ_NOTNULL(bes, vc->backend->priv, BES_MAGIC); - - assert(vc->fd >= 0); - WSL(w, SLT_BackendReuse, vc->fd, "%s", vc->backend->vcl_name); - LOCK(&vc->backend->mtx); - VSL_stats->backend_recycle++; - VTAILQ_INSERT_HEAD(&bes->connlist, vc, list); - VBE_DropRefLocked(vc->backend); -} - -/*--------------------------------------------------------------------*/ - -static void -bes_Cleanup(const struct backend *b) -{ - struct bes *bes; - struct vbe_conn *vbe; - - assert(b->refcount == 0); - CAST_OBJ_NOTNULL(bes, b->priv, BES_MAGIC); - free(bes->portname); - free(bes->hostname); - freeaddrinfo(bes->addr); - while (1) { - vbe = VTAILQ_FIRST(&bes->connlist); - if (vbe == NULL) - break; - VTAILQ_REMOVE(&bes->connlist, vbe, list); - if (vbe->fd >= 0) - AZ(close(vbe->fd)); - FREE_OBJ(vbe); - } - FREE_OBJ(bes); -} - -/*--------------------------------------------------------------------*/ - -static const char * -bes_GetHostname(const struct backend *b) -{ - struct bes *bes; - - CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC); - CAST_OBJ_NOTNULL(bes, b->priv, BES_MAGIC); - return (bes->hostname); -} - - -#endif Added: trunk/varnish-cache/bin/varnishd/cache_dir_random.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_dir_random.c (rev 0) +++ trunk/varnish-cache/bin/varnishd/cache_dir_random.c 2008-02-07 09:54:42 UTC (rev 2442) @@ -0,0 +1,139 @@ +/*- + * Copyright (c) 2006 Verdens Gang AS + * Copyright (c) 2006-2008 Linpro AS + * All rights reserved. + * + * Author: Poul-Henning Kamp + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id$ + * + */ + +#include +#include + +#include +#include +#include +#include + +#include "shmlog.h" +#include "cache.h" +#include "vrt.h" + +/*--------------------------------------------------------------------*/ + +struct vdi_random_host { + struct backend *backend; + unsigned weight; +}; + +struct vdi_random { + unsigned magic; +#define VDI_RANDOM_MAGIC 0x476d25b7 + struct director dir; + struct backend *backend; + unsigned nhosts; + struct vdi_random_host *hosts; +}; + + +static struct backend * +vdi_random_choose(struct sess *sp) +{ + struct vdi_random *vs; + uint32_t r; + struct vdi_random_host *vh; + + CHECK_OBJ_NOTNULL(sp->director, DIRECTOR_MAGIC); + CAST_OBJ_NOTNULL(vs, sp->director->priv, VDI_RANDOM_MAGIC); + r = random(); + r &= 0x7fffffff; + + for (vh = vs->hosts; ; vh++) + if (r < vh->weight) + return (vh->backend); + assert(0 != __LINE__); + return (NULL); +} + +static void +vdi_random_fini(struct director *d) +{ + struct vdi_random *vs; + + CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); + CAST_OBJ_NOTNULL(vs, d->priv, VDI_RANDOM_MAGIC); + + VBE_DropRef(vs->backend); + free(vs->hosts); + free(vs); +} + +void +VRT_init_dir_random(struct cli *cli, struct director **bp, const struct vrt_dir_random *t) +{ + struct vdi_random *vs; + const struct vrt_dir_random_entry *te; + struct vdi_random_host *vh; + double s, a, b; + unsigned v; + int i; + + (void)cli; + + vs = calloc(sizeof *vs, 1); + XXXAN(vs); + vs->hosts = calloc(sizeof *vh, t->nmember); + XXXAN(vs->hosts); + + vs->magic = VDI_RANDOM_MAGIC; + vs->dir.magic = DIRECTOR_MAGIC; + vs->dir.priv = vs; + vs->dir.name = "random"; + vs->dir.choose = vdi_random_choose; + vs->dir.fini = vdi_random_fini; + + s = 0; + vh = vs->hosts; + te = t->members; + for (i = 0; i < t->nmember; i++, vh++, te++) { + s += te->weight; + vh->backend = VBE_AddBackend(cli, te->host); + } + + /* Normalize weights */ + i = 0; + a = 0.0; + for (te = t->members; te->host != NULL; te++, i++) { + /* First normalize the specified weight in FP */ + b = te->weight / s; + /* Then accumulate to eliminate rounding errors */ + a += b; + /* Convert to unsigned in random() range */ + v = (unsigned)((1U<<31) * a); + vs->hosts[i].weight = v; + } + *bp = &vs->dir; +} From phk at projects.linpro.no Sat Feb 9 15:59:21 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 9 Feb 2008 16:59:21 +0100 (CET) Subject: r2443 - trunk/varnish-cache/lib/libvarnishapi Message-ID: <20080209155921.464411EC2B1@projects.linpro.no> Author: phk Date: 2008-02-09 16:59:21 +0100 (Sat, 09 Feb 2008) New Revision: 2443 Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c Log: required by Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2008-02-07 09:54:42 UTC (rev 2442) +++ trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2008-02-09 15:59:21 UTC (rev 2443) @@ -29,6 +29,7 @@ * $Id$ */ +#include #include #include From des at projects.linpro.no Sun Feb 10 18:00:34 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 10 Feb 2008 19:00:34 +0100 (CET) Subject: r2444 - trunk/varnish-cache/bin/varnishlog Message-ID: <20080210180034.108EF1EC384@projects.linpro.no> Author: des Date: 2008-02-10 19:00:33 +0100 (Sun, 10 Feb 2008) New Revision: 2444 Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c Log: Alphabetize command-line options. Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2008-02-09 15:59:21 UTC (rev 2443) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2008-02-10 18:00:33 UTC (rev 2444) @@ -297,6 +297,14 @@ case 'a': a_flag = 1; break; + case 'b': + b_flag = 1; + VSL_Arg(vd, c, optarg); + break; + case 'c': + c_flag = 1; + VSL_Arg(vd, c, optarg); + break; case 'D': D_flag = 1; break; @@ -315,16 +323,6 @@ case 'w': w_arg = optarg; break; - case 'c': - c_flag = 1; - if (VSL_Arg(vd, c, optarg) > 0) - break; - usage(); - case 'b': - b_flag = 1; - if (VSL_Arg(vd, c, optarg) > 0) - break; - usage(); default: if (VSL_Arg(vd, c, optarg) > 0) break; From des at projects.linpro.no Mon Feb 11 02:58:41 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 11 Feb 2008 03:58:41 +0100 (CET) Subject: r2445 - trunk/varnish-cache/bin/varnishncsa Message-ID: <20080211025841.C5F6C1EC526@projects.linpro.no> Author: des Date: 2008-02-11 03:58:41 +0100 (Mon, 11 Feb 2008) New Revision: 2445 Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c Log: Separate the handling of backend and client requests, greatly simplifying both. Skip piped requests, and requests that are interrupted by an error. This should eliminate or at least greatly reduce the (null)s seen in logs. Fix a conditional that blocked backend requests from being printed. Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2008-02-10 18:00:33 UTC (rev 2444) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2008-02-11 02:58:41 UTC (rev 2445) @@ -92,14 +92,13 @@ char *df_h; /* %h (host name / IP adress)*/ char *df_m; /* %m, Request method*/ char *df_s; /* %s, Status */ + struct tm df_t; /* %t, Date and time */ char *df_u; /* %u, Remote user */ int bogus; /* bogus request */ } **ll; static size_t nll; -static time_t t; - static int isprefix(const char *str, const char *prefix, const char *end, const char **next) { @@ -175,53 +174,105 @@ } static int -h_ncsa(void *priv, enum shmlogtag tag, unsigned fd, - unsigned len, unsigned spec, const char *ptr) +collect_backend(struct logline *lp, enum shmlogtag tag, unsigned spec, + const char *ptr, unsigned len) { const char *end, *next; - char *q; - FILE *fo; - long l; - struct tm tm; - char tbuf[40]; - struct logline *lp; + assert(spec & VSL_S_BACKEND); end = ptr + len; - if (!(spec & VSL_S_CLIENT || spec & VSL_S_BACKEND)) - return (reopen); - - if (fd >= nll) { - struct logline **newll = ll; - size_t newnll = nll; - - while (fd >= newnll) - newnll += newnll + 1; - newll = realloc(newll, newnll * sizeof *newll); - assert(newll != NULL); - memset(newll + nll, 0, (newnll - nll) * sizeof *newll); - ll = newll; - nll = newnll; - } - if (ll[fd] == NULL) { - ll[fd] = calloc(sizeof *ll[fd], 1); - assert(ll[fd] != NULL); - } - lp = ll[fd]; - switch (tag) { case SLT_BackendOpen: - if (!(spec & VSL_S_BACKEND)) - break; if (lp->df_h != NULL) lp->bogus = 1; - else { + else if (isprefix(ptr, "default", end, &next)) lp->df_h = trimfield(next, end); else lp->df_h = trimfield(ptr, end); - } break; + + case SLT_TxRequest: + if (lp->df_m != NULL) + lp->bogus = 1; + else + lp->df_m = trimline(ptr, end); + break; + + case SLT_TxURL: + if (lp->df_Uq != NULL) + lp->bogus = 1; + else + lp->df_Uq = trimline(ptr, end); + break; + + case SLT_TxProtocol: + if (lp->df_H != NULL) + lp->bogus = 1; + else + lp->df_H = trimline(ptr, end); + break; + + case SLT_RxStatus: + if (lp->df_s != NULL) + lp->bogus = 1; + else + lp->df_s = trimline(ptr, end); + break; + + case SLT_RxHeader: + if (isprefix(ptr, "content-length:", end, &next)) + lp->df_b = trimline(next, end); + else if (isprefix(ptr, "date:", end, &next) && + strptime(next, "%a, %d %b %Y %T", &lp->df_t) == NULL) + lp->bogus = 1; + break; + + case SLT_TxHeader: + if (isprefix(ptr, "user-agent:", end, &next)) + lp->df_User_agent = trimline(next, end); + else if (isprefix(ptr, "referer:", end, &next)) + lp->df_Referer = trimline(next, end); + else if (isprefix(ptr, "authorization:", end, &next) && + isprefix(next, "basic", end, &next)) + lp->df_u = trimline(next, end); + else if (isprefix(ptr, "host:", end, &next)) + lp->df_Host = trimline(next, end); + break; + + case SLT_Length: + if (lp->df_b != NULL) + lp->bogus = 1; + else + lp->df_b = trimline(ptr, end); + break; + + case SLT_BackendReuse: + case SLT_BackendClose: + /* got it all */ + return (0); + + default: + break; + } + + /* more to come */ + return (1); +} + +static int +collect_client(struct logline *lp, enum shmlogtag tag, unsigned spec, + const char *ptr, unsigned len) +{ + const char *end, *next; + long l; + time_t t; + + assert(spec & VSL_S_CLIENT); + end = ptr + len; + + switch (tag) { case SLT_ReqStart: if (lp->df_h != NULL) lp->bogus = 1; @@ -229,71 +280,35 @@ lp->df_h = trimfield(ptr, end); break; - case SLT_TxRequest: - if (!(spec & VSL_S_BACKEND)) - break; case SLT_RxRequest: - if (tag == SLT_RxRequest && (spec & VSL_S_BACKEND)) - break; - if (lp->df_m != NULL) lp->bogus = 1; else lp->df_m = trimline(ptr, end); break; - case SLT_TxURL: - if (!(spec & VSL_S_BACKEND)) - break; case SLT_RxURL: - if (tag == SLT_RxURL && (spec & VSL_S_BACKEND)) - break; - if (lp->df_Uq != NULL) lp->bogus = 1; else lp->df_Uq = trimline(ptr, end); break; - case SLT_TxProtocol: - if (!(spec & VSL_S_BACKEND)) - break; case SLT_RxProtocol: - if (tag == SLT_RxProtocol && (spec & VSL_S_BACKEND)) - break; - if (lp->df_H != NULL) lp->bogus = 1; else lp->df_H = trimline(ptr, end); break; - case SLT_RxStatus: - if (!(spec & VSL_S_BACKEND)) - break; case SLT_TxStatus: - if (tag == SLT_TxStatus && (spec & VSL_S_BACKEND)) - break; - if (lp->df_s != NULL) lp->bogus = 1; else lp->df_s = trimline(ptr, end); break; - case SLT_TxHeader: - if (!(spec & VSL_S_BACKEND)) - break; case SLT_RxHeader: - if (tag == SLT_RxHeader && (spec & VSL_S_BACKEND)) { - if (isprefix(ptr, "content-length:", end, &next)) { - lp->df_b = trimline(next, end); - } else if (isprefix(ptr, "date:", end, &next)) { - if (strptime(trimline(next, end), "%a, %d %b %Y %T", &tm)) - t = mktime(&tm); - } - break; - } if (isprefix(ptr, "user-agent:", end, &next)) lp->df_User_agent = trimline(next, end); else if (isprefix(ptr, "referer:", end, &next)) @@ -312,24 +327,73 @@ lp->df_b = trimline(ptr, end); break; + case SLT_SessionClose: + if (strncmp(ptr, "pipe", len) == 0 || + strncmp(ptr, "error", len) == 0) + lp->bogus = 1; + break; + + case SLT_ReqEnd: + if (sscanf(ptr, "%*u %*u.%*u %ld.", &l) != 1) { + lp->bogus = 1; + } else { + t = l; + localtime_r(&t, &lp->df_t); + } + /* got it all */ + return (0); + default: break; } - if ((spec & VSL_S_CLIENT) && tag != SLT_ReqEnd) - return (reopen); + /* more to come */ + return (1); +} - if ((spec & VSL_S_BACKEND) && tag != SLT_BackendReuse && - (tag != SLT_BackendClose || lp->df_Uq)) - return (reopen); +static int +h_ncsa(void *priv, enum shmlogtag tag, unsigned fd, + unsigned len, unsigned spec, const char *ptr) +{ + struct logline *lp; + FILE *fo = priv; + char *q, tbuf[64]; - if (tag == SLT_ReqEnd) { - if (sscanf(ptr, "%*u %*u.%*u %ld.", &l) != 1) - lp->bogus = 1; - else - t = l; + if (fd >= nll) { + struct logline **newll = ll; + size_t newnll = nll; + + while (fd >= newnll) + newnll += newnll + 1; + newll = realloc(newll, newnll * sizeof *newll); + assert(newll != NULL); + memset(newll + nll, 0, (newnll - nll) * sizeof *newll); + ll = newll; + nll = newnll; } + if (ll[fd] == NULL) { + ll[fd] = calloc(sizeof *ll[fd], 1); + assert(ll[fd] != NULL); + } + lp = ll[fd]; + if (spec & VSL_S_BACKEND) { + if (collect_backend(lp, tag, spec, ptr, len)) + return (reopen); + } else if (spec & VSL_S_CLIENT) { + if (collect_client(lp, tag, spec, ptr, len)) + return (reopen); + } else { + /* huh? */ + return (reopen); + } + +#if 0 + /* non-optional fields */ + if (!lp->df_m || !lp->df_Uq || !lp->df_H || !lp->df_s) + lp->bogus = 1; +#endif + if (!lp->bogus) { fo = priv; @@ -362,8 +426,7 @@ } /* %t */ - localtime_r(&t, &tm); - strftime(tbuf, sizeof tbuf, "[%d/%b/%Y:%T %z]", &tm); + strftime(tbuf, sizeof tbuf, "[%d/%b/%Y:%T %z]", &lp->df_t); fprintf(fo, "%s ", tbuf); /* @@ -383,7 +446,7 @@ fprintf(fo, "%s ", lp->df_s); /* %b */ - fprintf(fo, "%s ", lp->df_b); + fprintf(fo, "%s ", lp->df_b ? lp->df_b : "-"); /* %{Referer}i */ fprintf(fo, "\"%s\" ", @@ -411,7 +474,7 @@ freez(lp->df_s); freez(lp->df_u); #undef freez - lp->bogus = 0; + memset(lp, 0, sizeof *lp); return (reopen); } From des at projects.linpro.no Mon Feb 11 10:46:09 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 11 Feb 2008 11:46:09 +0100 (CET) Subject: r2446 - trunk/varnish-cache/etc Message-ID: <20080211104609.67FCE1EC2B1@projects.linpro.no> Author: des Date: 2008-02-11 11:46:09 +0100 (Mon, 11 Feb 2008) New Revision: 2446 Modified: trunk/varnish-cache/etc/default.vcl Log: Update backend declaration syntax. Note that a) vcl.7 needs a partial rewrite to track this change, and b) there have been other changes which also need to be merged in. Modified: trunk/varnish-cache/etc/default.vcl =================================================================== --- trunk/varnish-cache/etc/default.vcl 2008-02-11 02:58:41 UTC (rev 2445) +++ trunk/varnish-cache/etc/default.vcl 2008-02-11 10:46:09 UTC (rev 2446) @@ -9,8 +9,8 @@ # server. backend default { - set backend.host = "127.0.0.1"; - set backend.port = "8080"; + .host = "127.0.0.1"; + .port = "8080"; } # Below is a commented-out copy of the default VCL logic. If you From ssm at projects.linpro.no Tue Feb 12 06:52:33 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Tue, 12 Feb 2008 07:52:33 +0100 (CET) Subject: r2447 - trunk/varnish-cache/bin/varnishd Message-ID: <20080212065233.7A8F71EC6BC@projects.linpro.no> Author: ssm Date: 2008-02-12 07:52:33 +0100 (Tue, 12 Feb 2008) New Revision: 2447 Modified: trunk/varnish-cache/bin/varnishd/varnishd.1 Log: Add information to \"-a\" about how to listen on multiple hosts or ports Modified: trunk/varnish-cache/bin/varnishd/varnishd.1 =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.1 2008-02-11 10:46:09 UTC (rev 2446) +++ trunk/varnish-cache/bin/varnishd/varnishd.1 2008-02-12 06:52:33 UTC (rev 2447) @@ -84,7 +84,11 @@ .Ar port is not specified, the default HTTP port as listed in .Pa /etc/services -is used. +is used. To listen on multiple hosts or ports, the argument to +.Fl a +can be a (quoted) whitespace separated list of +.Ar address Ns Op : Ns Ar port +tokens. .It Fl b Ar host Ns Op : Ns Ar port Use the specified .Ar host From phk at projects.linpro.no Wed Feb 13 10:55:04 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 13 Feb 2008 11:55:04 +0100 (CET) Subject: r2448 - trunk/varnish-cache/man Message-ID: <20080213105504.1E68E1EC6AA@projects.linpro.no> Author: phk Date: 2008-02-13 11:55:03 +0100 (Wed, 13 Feb 2008) New Revision: 2448 Modified: trunk/varnish-cache/man/vcl.7 Log: Fix example to new backend syntax Modified: trunk/varnish-cache/man/vcl.7 =================================================================== --- trunk/varnish-cache/man/vcl.7 2008-02-12 06:52:33 UTC (rev 2447) +++ trunk/varnish-cache/man/vcl.7 2008-02-13 10:55:03 UTC (rev 2448) @@ -80,8 +80,8 @@ A backend declaration creates and initializes a named backend object: .Bd -literal -offset 4n backend www { - set backend.host = "www.example.com"; - set backend.port = "http"; + .host = "www.example.com"; + .port = "http"; } .Ed .Pp From phk at projects.linpro.no Wed Feb 13 10:56:36 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 13 Feb 2008 11:56:36 +0100 (CET) Subject: r2449 - trunk/varnish-cache/bin/varnishd Message-ID: <20080213105636.D30BC1EC384@projects.linpro.no> Author: phk Date: 2008-02-13 11:56:36 +0100 (Wed, 13 Feb 2008) New Revision: 2449 Modified: trunk/varnish-cache/bin/varnishd/heritage.h trunk/varnish-cache/bin/varnishd/mgt_param.c Log: Add a parameter for controlling caching of vbe_conn structures. (the code that it controls follows in a minute) I'm very interested to hear if there is any measurable effect of this variable on heavily loaded systems. Modified: trunk/varnish-cache/bin/varnishd/heritage.h =================================================================== --- trunk/varnish-cache/bin/varnishd/heritage.h 2008-02-13 10:55:03 UTC (rev 2448) +++ trunk/varnish-cache/bin/varnishd/heritage.h 2008-02-13 10:56:36 UTC (rev 2449) @@ -135,6 +135,9 @@ /* Rush exponent */ unsigned rush_exponent; + + /* Cache vbe_conns */ + unsigned cache_vbe_conns; }; extern volatile struct params *params; Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-02-13 10:55:03 UTC (rev 2448) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-02-13 10:56:36 UTC (rev 2449) @@ -580,6 +580,13 @@ tweak_generic_uint(cli, &master.max_esi_includes, arg, 0, UINT_MAX); } +static void +tweak_cache_vbe_conns(struct cli *cli, struct parspec *par, const char *arg) +{ + (void)par; + tweak_generic_bool(cli, &master.cache_vbe_conns, arg); +} + /*--------------------------------------------------------------------*/ /* @@ -788,6 +795,10 @@ "the backend, so don't increase thoughtlessly.\n", 0, "5", "restarts" }, + { "cache_vbe_conns", tweak_cache_vbe_conns, + "Cache vbe_conn's or rely on malloc, that's the question.", + EXPERIMENTAL, + "off", "bool" }, { NULL, NULL, NULL } }; From phk at projects.linpro.no Wed Feb 13 10:57:17 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 13 Feb 2008 11:57:17 +0100 (CET) Subject: r2450 - trunk/varnish-cache/include Message-ID: <20080213105717.CDF481EC6AA@projects.linpro.no> Author: phk Date: 2008-02-13 11:57:17 +0100 (Wed, 13 Feb 2008) New Revision: 2450 Modified: trunk/varnish-cache/include/stat_field.h Log: Add two new stat fields for counting bereq's and backends. Modified: trunk/varnish-cache/include/stat_field.h =================================================================== --- trunk/varnish-cache/include/stat_field.h 2008-02-13 10:56:36 UTC (rev 2449) +++ trunk/varnish-cache/include/stat_field.h 2008-02-13 10:57:17 UTC (rev 2450) @@ -52,6 +52,7 @@ MAC_STAT(n_smf_frag, uint64_t, 'i', "N small free smf") MAC_STAT(n_smf_large, uint64_t, 'i', "N large free smf") MAC_STAT(n_vbe_conn, uint64_t, 'i', "N struct vbe_conn") +MAC_STAT(n_bereq, uint64_t, 'i', "N struct bereq") MAC_STAT(n_wrk, uint64_t, 'i', "N worker threads") MAC_STAT(n_wrk_create, uint64_t, 'a', "N worker threads created") MAC_STAT(n_wrk_failed, uint64_t, 'a', "N worker threads not created") @@ -59,6 +60,7 @@ MAC_STAT(n_wrk_queue, uint64_t, 'a', "N queued work requests") MAC_STAT(n_wrk_overflow, uint64_t, 'a', "N overflowed work requests") MAC_STAT(n_wrk_drop, uint64_t, 'a', "N dropped work requests") +MAC_STAT(n_backend, uint64_t, 'i', "N backends") MAC_STAT(n_expired, uint64_t, 'i', "N expired objects") MAC_STAT(n_lru_nuked, uint64_t, 'i', "N LRU nuked objects") From phk at projects.linpro.no Wed Feb 13 10:59:26 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 13 Feb 2008 11:59:26 +0100 (CET) Subject: r2451 - trunk/varnish-cache/bin/varnishd Message-ID: <20080213105926.021591EC384@projects.linpro.no> Author: phk Date: 2008-02-13 11:59:25 +0100 (Wed, 13 Feb 2008) New Revision: 2451 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_backend.c Log: Go over the backend code and privatize a lot of stuff that now belongs only in cache_backend.c Control the caching of bereq's via the parameter. Found no bugs, so I think I will release -trunk for adventurous testers again. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-02-13 10:57:17 UTC (rev 2450) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-02-13 10:59:25 UTC (rev 2451) @@ -392,15 +392,8 @@ VTAILQ_ENTRY(vbe_conn) list; struct backend *backend; int fd; - void *priv; }; -/* - * NB: This list is not locked, it is only ever manipulated from the - * cachers CLI thread. - */ -VTAILQ_HEAD(backendlist, backend); - /* Prototypes etc ----------------------------------------------------*/ @@ -419,18 +412,10 @@ void VBE_RecycleFd(struct worker *w, struct vbe_conn *vc); struct bereq * VBE_new_bereq(void); void VBE_free_bereq(struct bereq *bereq); -extern struct backendlist backendlist; void VBE_DropRef(struct backend *); -void VBE_DropRefLocked(struct backend *); struct backend *VBE_AddBackend(struct cli *cli, const struct vrt_backend *vb); -struct vbe_conn *VBE_NewConn(void); -void VBE_ReleaseConn(struct vbe_conn *); void VBE_UpdateHealth(const struct sess *sp, const struct vbe_conn *, int); -/* convenience functions for backend methods */ -int VBE_TryConnect(const struct sess *sp, const struct addrinfo *ai); -int VBE_CheckFd(int fd); - /* cache_ban.c */ void AddBan(const char *, int hash); void BAN_Init(void); Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend.c 2008-02-13 10:57:17 UTC (rev 2450) +++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2008-02-13 10:59:25 UTC (rev 2451) @@ -28,8 +28,42 @@ * * $Id$ * - * Manage backend connections and requests. + * This is the central switch-board for backend connections and it is + * slightly complicated by a number of optimizations. * + * The data structures: + * + * A backend is a TCP destination, possibly multi-homed and it has a + * number of associated properties and statistics. + * + * A vbe_conn is an open TCP connection to a backend. + * + * A bereq is a memory carrier for handling a HTTP transaction with + * a backend over a vbe_conn. + * + * A director is a piece of code that selects which backend to use, + * by whatever method or metric it chooses. + * + * The relationships: + * + * Backends and directors get instantiated when VCL's are loaded, + * and this always happen in the CLI thread. + * + * When a VCL tries to instantiate a backend, any existing backend + * with the same identity (== definition in VCL) will be used instead + * so that vbe_conn's can be reused across VCL changes. + * + * Directors disapper with the VCL that created them. + * + * Backends disappear when their reference count drop to zero. + * + * Backends have their host/port name looked up to addrinfo structures + * when they are instantiated, and we just cache that result and cycle + * through the entries (for multihomed backends) on failure only. + * XXX: add cli command to redo lookup. + * + * bereq is sort of a step-child here, we just manage the pool of them. + * */ #include @@ -67,13 +101,25 @@ double last_check; }; +static MTX VBE_mtx; + +/* + * List of cached vbe_conns, used if enabled in params/heritage + */ +static VTAILQ_HEAD(,vbe_conn) vbe_conns = VTAILQ_HEAD_INITIALIZER(vbe_conns); + +/* + * List of cached bereq's + */ static VTAILQ_HEAD(,bereq) bereq_head = VTAILQ_HEAD_INITIALIZER(bereq_head); -static VTAILQ_HEAD(,vbe_conn) vbe_head = VTAILQ_HEAD_INITIALIZER(vbe_head); -static MTX VBE_mtx; +/* + * The list of backends is not locked, it is only ever accessed from + * the CLI thread, so there is no need. + */ +static VTAILQ_HEAD(, backend) backends = + VTAILQ_HEAD_INITIALIZER(backends); -struct backendlist backendlist = VTAILQ_HEAD_INITIALIZER(backendlist); - /*-------------------------------------------------------------------- * Attempt to connect to a given addrinfo entry. * @@ -83,7 +129,7 @@ * */ -int +static int VBE_TryConnect(const struct sess *sp, const struct addrinfo *ai) { struct sockaddr_storage ss; @@ -93,6 +139,9 @@ char abuf1[TCP_ADDRBUFSIZE], abuf2[TCP_ADDRBUFSIZE]; char pbuf1[TCP_PORTBUFSIZE], pbuf2[TCP_PORTBUFSIZE]; + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + CHECK_OBJ_NOTNULL(sp->backend, BACKEND_MAGIC); + /* * ai is only valid with the lock held, so copy out the bits * we need to make the connection @@ -120,8 +169,7 @@ } TCP_myname(s, abuf1, sizeof abuf1, pbuf1, sizeof pbuf1); - TCP_name((void*)&ss, alen, - abuf2, sizeof abuf2, pbuf2, sizeof pbuf2); + TCP_name((void*)&ss, alen, abuf2, sizeof abuf2, pbuf2, sizeof pbuf2); WSL(sp->wrk, SLT_BackendOpen, s, "%s %s %s %s %s", sp->backend->vrt->vcl_name, abuf1, pbuf1, abuf2, pbuf2); @@ -130,12 +178,12 @@ } /*-------------------------------------------------------------------- - * Check that there is still something at the far end of a given fd. + * Check that there is still something at the far end of a given socket. * We poll the fd with instant timeout, if there are any events we can't * use it (backends are not allowed to pipeline). */ -int +static int VBE_CheckFd(int fd) { struct pollfd pfd; @@ -147,7 +195,10 @@ } /*-------------------------------------------------------------------- - * Get a http structure for talking to the backend. + * Get a bereq structure for talking HTTP with the backend. + * First attempt to pick one from our stash, else make a new. + * + * Can fail with NULL. */ struct bereq * @@ -170,13 +221,15 @@ return (NULL); bereq->magic = BEREQ_MAGIC; WS_Init(bereq->ws, "bereq", bereq + 1, len); + VSL_stats->n_bereq++; } http_Setup(bereq->http, bereq->ws); return (bereq); } -/*--------------------------------------------------------------------*/ -/* XXX: no backpressure on pool size */ +/*-------------------------------------------------------------------- + * Return a bereq to the stash. + */ void VBE_free_bereq(struct bereq *bereq) @@ -189,20 +242,24 @@ UNLOCK(&VBE_mtx); } -/*--------------------------------------------------------------------*/ +/*-------------------------------------------------------------------- + * Manage a pool of vbe_conn structures. + * XXX: as an experiment, make this caching controled by a parameter + * XXX: so we can see if it has any effect. + */ -struct vbe_conn * +static struct vbe_conn * VBE_NewConn(void) { struct vbe_conn *vc; - vc = VTAILQ_FIRST(&vbe_head); + vc = VTAILQ_FIRST(&vbe_conns); if (vc != NULL) { LOCK(&VBE_mtx); - vc = VTAILQ_FIRST(&vbe_head); + vc = VTAILQ_FIRST(&vbe_conns); if (vc != NULL) { VSL_stats->backend_unused--; - VTAILQ_REMOVE(&vbe_head, vc, list); + VTAILQ_REMOVE(&vbe_conns, vc, list); } else { VSL_stats->n_vbe_conn++; } @@ -210,7 +267,6 @@ } if (vc != NULL) return (vc); - vc = calloc(sizeof *vc, 1); XXXAN(vc); vc->magic = VBE_CONN_MAGIC; @@ -218,50 +274,59 @@ return (vc); } -/*--------------------------------------------------------------------*/ - -void +static void VBE_ReleaseConn(struct vbe_conn *vc) { CHECK_OBJ_NOTNULL(vc, VBE_CONN_MAGIC); assert(vc->backend == NULL); assert(vc->fd < 0); - LOCK(&VBE_mtx); - VTAILQ_INSERT_HEAD(&vbe_head, vc, list); - VSL_stats->backend_unused++; - UNLOCK(&VBE_mtx); + + if (params->cache_vbe_conns) { + LOCK(&VBE_mtx); + VTAILQ_INSERT_HEAD(&vbe_conns, vc, list); + VSL_stats->backend_unused++; + UNLOCK(&VBE_mtx); + } else { + VSL_stats->n_vbe_conn--; + free(vc); + } } +/*-------------------------------------------------------------------- + * Drop a reference to a backend. + * The last reference must come from the watcher in the CLI thread, + * as only that thread is allowed to clean up the backend list. + */ -/*--------------------------------------------------------------------*/ - -void +static void VBE_DropRefLocked(struct backend *b) { int i; struct vbe_conn *vbe, *vbe2; CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC); + assert(b->refcount > 0); i = --b->refcount; UNLOCK(&b->mtx); - if (i) + if (i > 0) return; - ASSERT_CLI(); /* XXX: ?? */ - VTAILQ_REMOVE(&backendlist, b, list); + ASSERT_CLI(); + VTAILQ_REMOVE(&backends, b, list); VTAILQ_FOREACH_SAFE(vbe, &b->connlist, list, vbe2) { VTAILQ_REMOVE(&b->connlist, vbe, list); if (vbe->fd >= 0) AZ(close(vbe->fd)); - FREE_OBJ(vbe); + VBE_ReleaseConn(vbe); } free(TRUST_ME(b->vrt->ident)); free(TRUST_ME(b->vrt->hostname)); free(TRUST_ME(b->vrt->portname)); b->magic = 0; free(b); + VSL_stats->n_backend--; } void @@ -278,8 +343,10 @@ * Try to get a socket connected to one of the addresses on the list. * We start from the cached "last good" address and try all items on * the list exactly once. - * If a new DNS lookup is made while we try, we start over and try the - * new list exactly once. + * + * Called with backend mutex held, but will release/acquire it. + * + * XXX: Not ready for DNS re-lookups */ static int @@ -289,14 +356,16 @@ int s, loops; CHECK_OBJ_NOTNULL(bp, BACKEND_MAGIC); - if (bp->last_ai == NULL) + + /* No addrinfo, no connection */ + if (bp->ai == NULL) return (-1); - AN(bp->ai); + AN(bp->last_ai); /* Called with lock held */ loops = 0; ai = from = bp->last_ai; - while (1) { + while (loops == 0 || ai != from) { /* NB: releases/acquires backend lock */ s = VBE_TryConnect(sp, ai); @@ -312,9 +381,9 @@ loops++; ai = bp->ai; } - if (loops == 1 && ai == from) - return (-1); } + /* We have tried them all, fail */ + return (-1); } @@ -326,15 +395,12 @@ int s; LOCK(&bp->mtx); - - s = bes_conn_try_list(sp, bp); - if (s >= 0) { - bp->refcount++; - UNLOCK(&bp->mtx); - return (s); - } + bp->refcount++; + s = bes_conn_try_list(sp, bp); /* releases/acquires backend lock */ + if (s < 0) + bp->refcount--; /* Only keep ref on success */ UNLOCK(&bp->mtx); - return (-1); + return (s); } /*--------------------------------------------------------------------*/ @@ -351,6 +417,7 @@ CHECK_OBJ_NOTNULL(bp, BACKEND_MAGIC); sp->backend = bp; + /* first look for vbe_conn's we can recycle */ while (1) { LOCK(&bp->mtx); vc = VTAILQ_FIRST(&bp->connlist); @@ -515,7 +582,7 @@ AN(vb->ident); (void)cli; ASSERT_CLI(); - VTAILQ_FOREACH(b, &backendlist, list) { + VTAILQ_FOREACH(b, &backends, list) { CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC); if (strcmp(b->vrt->ident, vb->ident)) continue; @@ -549,7 +616,8 @@ b->last_check = TIM_mono(); - VTAILQ_INSERT_TAIL(&backendlist, b, list); + VTAILQ_INSERT_TAIL(&backends, b, list); + VSL_stats->n_backend++; return (b); } From phk at projects.linpro.no Wed Feb 13 11:35:10 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 13 Feb 2008 12:35:10 +0100 (CET) Subject: r2452 - trunk/varnish-cache/bin/varnishd Message-ID: <20080213113510.C7F0B1EC35F@projects.linpro.no> Author: phk Date: 2008-02-13 12:35:10 +0100 (Wed, 13 Feb 2008) New Revision: 2452 Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c Log: Fix a bug relating to vbe_conn statistics counter. Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend.c 2008-02-13 10:59:25 UTC (rev 2451) +++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2008-02-13 11:35:10 UTC (rev 2452) @@ -260,8 +260,6 @@ if (vc != NULL) { VSL_stats->backend_unused--; VTAILQ_REMOVE(&vbe_conns, vc, list); - } else { - VSL_stats->n_vbe_conn++; } UNLOCK(&VBE_mtx); } @@ -271,6 +269,7 @@ XXXAN(vc); vc->magic = VBE_CONN_MAGIC; vc->fd = -1; + VSL_stats->n_vbe_conn++; return (vc); } From des at projects.linpro.no Wed Feb 13 13:05:36 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Wed, 13 Feb 2008 14:05:36 +0100 (CET) Subject: r2453 - trunk/varnish-cache Message-ID: <20080213130536.F0AD81EC6BC@projects.linpro.no> Author: des Date: 2008-02-13 14:05:36 +0100 (Wed, 13 Feb 2008) New Revision: 2453 Modified: trunk/varnish-cache/configure.ac Log: Some source files (especially in libraries) have embedded test programs. Add a configure option and a corresponding automake conditional to enable these tests. Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2008-02-13 11:35:10 UTC (rev 2452) +++ trunk/varnish-cache/configure.ac 2008-02-13 13:05:36 UTC (rev 2453) @@ -293,6 +293,11 @@ 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)]), From des at projects.linpro.no Wed Feb 13 13:29:41 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Wed, 13 Feb 2008 14:29:41 +0100 (CET) Subject: r2454 - trunk/varnish-cache/lib/libvarnish Message-ID: <20080213132941.1B00F1EC454@projects.linpro.no> Author: des Date: 2008-02-13 14:29:40 +0100 (Wed, 13 Feb 2008) New Revision: 2454 Modified: trunk/varnish-cache/lib/libvarnish/Makefile.am trunk/varnish-cache/lib/libvarnish/num.c Log: Rewrite str2bytes, add unit test Modified: trunk/varnish-cache/lib/libvarnish/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libvarnish/Makefile.am 2008-02-13 13:05:36 UTC (rev 2453) +++ trunk/varnish-cache/lib/libvarnish/Makefile.am 2008-02-13 13:29:40 UTC (rev 2454) @@ -23,3 +23,15 @@ libvarnish_la_CFLAGS = -include config.h 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 + +test: ${TESTS} + @for test in ${TESTS} ; do ./$${test} ; done +endif Modified: trunk/varnish-cache/lib/libvarnish/num.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/num.c 2008-02-13 13:05:36 UTC (rev 2453) +++ trunk/varnish-cache/lib/libvarnish/num.c 2008-02-13 13:29:40 UTC (rev 2454) @@ -30,8 +30,9 @@ * Deal with numbers with data storage suffix scaling */ -#include +#include #include +#include #include #include @@ -39,41 +40,135 @@ const char * str2bytes(const char *p, uintmax_t *r, uintmax_t rel) { - int i; - double l; - char suff[2]; + double fval; + char *end; - i = sscanf(p, "%lg%1s", &l, suff); + fval = strtod(p, &end); + if (end == p || !isfinite(fval)) + return ("Invalid number"); - assert(i >= -1 && i <= 2); + if (*end == '\0') { + *r = (uintmax_t)fval; + return (NULL); + } - if (i < 1) - return ("Could not find any number"); + if (end[0] == '%' && end[1] == '\0') { + if (rel == 0) + return ("Absolute number required"); + fval *= rel / 100.0; + } else { + /* accept a space before the multiplier */ + if (end[0] == ' ' && end[1] != '\0') + ++end; - if (l < 0.0) - return ("Negative numbers not allowed"); + switch (end[0]) { + case 'k': case 'K': + fval *= (uintmax_t)1 << 10; + ++end; + break; + case 'm': case 'M': + fval *= (uintmax_t)1 << 20; + ++end; + break; + case 'g': case 'G': + fval *= (uintmax_t)1 << 30; + ++end; + break; + case 't': case 'T': + fval *= (uintmax_t)1 << 40; + ++end; + break; + case 'p': case 'P': + fval *= (uintmax_t)1 << 50; + ++end; + break; + case 'e': case 'E': + fval *= (uintmax_t)1 << 60; + ++end; + break; + } - if (i == 2) { - switch (tolower(*suff)) { - case 'b': break; - case 'k': l *= ((uintmax_t)1 << 10); break; - case 'm': l *= ((uintmax_t)1 << 20); break; - case 'g': l *= ((uintmax_t)1 << 30); break; - case 't': l *= ((uintmax_t)1 << 40); break; - case 'p': l *= ((uintmax_t)1 << 50); break; - case 'e': l *= ((uintmax_t)1 << 60); break; - case '%': - /* Percentage of 'rel' arg */ - if (rel != 0) { - l *= 1e-2 * rel; - break; - } - /*FALLTHROUGH*/ - default: - return ("Unknown scaling suffix [bkmgtpe] allowed"); - } + /* accept 'b' for 'bytes' */ + if (end[0] == 'b' || end[0] == 'B') + ++end; + + if (end[0] != '\0') + return ("Invalid suffix"); } - *r = (uintmax_t)(l + .5); + + /* intentionally not round(fval) to avoid need for -lm */ + *r = (uintmax_t)(fval + 0.5); return (NULL); } +#ifdef NUM_C_TEST +#include +#include +#include +#include + +struct test_case { + const char *str; + uintmax_t rel; + uintmax_t val; +} test_cases[] = { + { "1", (uintmax_t)0, (uintmax_t)1 }, + { "1B", (uintmax_t)0, (uintmax_t)1<<0 }, + { "1 B", (uintmax_t)0, (uintmax_t)1<<0 }, + { "1.3B", (uintmax_t)0, (uintmax_t)1 }, + { "1.7B", (uintmax_t)0, (uintmax_t)2 }, + + { "1024", (uintmax_t)0, (uintmax_t)1024 }, + { "1k", (uintmax_t)0, (uintmax_t)1<<10 }, + { "1kB", (uintmax_t)0, (uintmax_t)1<<10 }, + { "1.3kB", (uintmax_t)0, (uintmax_t)1331 }, + { "1.7kB", (uintmax_t)0, (uintmax_t)1741 }, + + { "1048576", (uintmax_t)0, (uintmax_t)1048576 }, + { "1M", (uintmax_t)0, (uintmax_t)1<<20 }, + { "1MB", (uintmax_t)0, (uintmax_t)1<<20 }, + { "1.3MB", (uintmax_t)0, (uintmax_t)1363149 }, + { "1.7MB", (uintmax_t)0, (uintmax_t)1782579 }, + + { "1073741824", (uintmax_t)0, (uintmax_t)1073741824 }, + { "1G", (uintmax_t)0, (uintmax_t)1<<30 }, + { "1GB", (uintmax_t)0, (uintmax_t)1<<30 }, + { "1.3GB", (uintmax_t)0, (uintmax_t)1395864371 }, + { "1.7GB", (uintmax_t)0, (uintmax_t)1825361101 }, + + { "1099511627776", (uintmax_t)0, (uintmax_t)1099511627776 }, + { "1T", (uintmax_t)0, (uintmax_t)1<<40 }, + { "1TB", (uintmax_t)0, (uintmax_t)1<<40 }, + { "1.3TB", (uintmax_t)0, (uintmax_t)1429365116109 }, + { "1.7TB", (uintmax_t)0, (uintmax_t)1869169767219 }, + + { "1%", (uintmax_t)1024, (uintmax_t)10 }, + { "2%", (uintmax_t)1024, (uintmax_t)20 }, + { "3%", (uintmax_t)1024, (uintmax_t)31 }, + /* TODO: add more */ + + { 0, 0, 0 }, +}; + +int +main(int argc, char *argv[]) +{ + struct test_case *tc; + uintmax_t val; + int ec; + + (void)argc; + for (ec = 0, tc = test_cases; tc->str; ++tc) { + str2bytes(tc->str, &val, tc->rel); + if (val != tc->val) { + printf("%s: str2bytes(\"%s\", %ju) %ju != %ju\n", + *argv, tc->str, tc->rel, val, tc->val); + ++ec; + } + } + /* TODO: test invalid strings */ + if (!ec) + printf("OK\n"); + return (ec > 0); +} +#endif From des at projects.linpro.no Wed Feb 13 13:55:39 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Wed, 13 Feb 2008 14:55:39 +0100 (CET) Subject: r2455 - in trunk/varnish-cache: bin/varnishadm bin/varnishd bin/varnishhist bin/varnishlog bin/varnishncsa bin/varnishreplay bin/varnishstat bin/varnishtop lib/libvarnish lib/libvarnishapi lib/libvarnishcompat lib/libvcl Message-ID: <20080213135539.BFA7D1EC35F@projects.linpro.no> Author: des Date: 2008-02-13 14:55:39 +0100 (Wed, 13 Feb 2008) New Revision: 2455 Modified: trunk/varnish-cache/bin/varnishadm/Makefile.am trunk/varnish-cache/bin/varnishadm/varnishadm.c trunk/varnish-cache/bin/varnishd/Makefile.am trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/bin/varnishd/cache_acceptor_epoll.c trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c trunk/varnish-cache/bin/varnishd/cache_backend.c trunk/varnish-cache/bin/varnishd/cache_ban.c trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/bin/varnishd/cache_cli.c trunk/varnish-cache/bin/varnishd/cache_dir_random.c trunk/varnish-cache/bin/varnishd/cache_dir_simple.c trunk/varnish-cache/bin/varnishd/cache_expire.c trunk/varnish-cache/bin/varnishd/cache_fetch.c trunk/varnish-cache/bin/varnishd/cache_hash.c trunk/varnish-cache/bin/varnishd/cache_http.c trunk/varnish-cache/bin/varnishd/cache_httpconn.c trunk/varnish-cache/bin/varnishd/cache_main.c trunk/varnish-cache/bin/varnishd/cache_panic.c trunk/varnish-cache/bin/varnishd/cache_pipe.c trunk/varnish-cache/bin/varnishd/cache_pool.c trunk/varnish-cache/bin/varnishd/cache_response.c trunk/varnish-cache/bin/varnishd/cache_session.c trunk/varnish-cache/bin/varnishd/cache_synthetic.c trunk/varnish-cache/bin/varnishd/cache_vary.c trunk/varnish-cache/bin/varnishd/cache_vcl.c trunk/varnish-cache/bin/varnishd/cache_vrt.c trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c trunk/varnish-cache/bin/varnishd/cache_vrt_re.c trunk/varnish-cache/bin/varnishd/cache_ws.c trunk/varnish-cache/bin/varnishd/hash_classic.c trunk/varnish-cache/bin/varnishd/hash_simple_list.c trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/bin/varnishd/mgt_event.c trunk/varnish-cache/bin/varnishd/mgt_param.c trunk/varnish-cache/bin/varnishd/mgt_vcc.c trunk/varnish-cache/bin/varnishd/rfc2616.c trunk/varnish-cache/bin/varnishd/shmlog.c trunk/varnish-cache/bin/varnishd/stevedore.c trunk/varnish-cache/bin/varnishd/storage_file.c trunk/varnish-cache/bin/varnishd/storage_malloc.c trunk/varnish-cache/bin/varnishd/tcp.c trunk/varnish-cache/bin/varnishd/varnishd.c trunk/varnish-cache/bin/varnishhist/Makefile.am trunk/varnish-cache/bin/varnishhist/varnishhist.c trunk/varnish-cache/bin/varnishlog/Makefile.am trunk/varnish-cache/bin/varnishlog/varnishlog.c trunk/varnish-cache/bin/varnishncsa/Makefile.am trunk/varnish-cache/bin/varnishncsa/varnishncsa.c trunk/varnish-cache/bin/varnishreplay/Makefile.am trunk/varnish-cache/bin/varnishreplay/varnishreplay.c trunk/varnish-cache/bin/varnishstat/Makefile.am trunk/varnish-cache/bin/varnishstat/varnishstat.c trunk/varnish-cache/bin/varnishtop/Makefile.am trunk/varnish-cache/bin/varnishtop/varnishtop.c trunk/varnish-cache/lib/libvarnish/Makefile.am trunk/varnish-cache/lib/libvarnish/argv.c trunk/varnish-cache/lib/libvarnish/assert.c trunk/varnish-cache/lib/libvarnish/binary_heap.c trunk/varnish-cache/lib/libvarnish/cli.c trunk/varnish-cache/lib/libvarnish/cli_common.c trunk/varnish-cache/lib/libvarnish/crc32.c trunk/varnish-cache/lib/libvarnish/flopen.c trunk/varnish-cache/lib/libvarnish/num.c trunk/varnish-cache/lib/libvarnish/time.c trunk/varnish-cache/lib/libvarnish/version.c trunk/varnish-cache/lib/libvarnish/vpf.c trunk/varnish-cache/lib/libvarnish/vsb.c trunk/varnish-cache/lib/libvarnish/vss.c trunk/varnish-cache/lib/libvarnish/vtmpfile.c trunk/varnish-cache/lib/libvarnishapi/Makefile.am trunk/varnish-cache/lib/libvarnishapi/base64.c trunk/varnish-cache/lib/libvarnishapi/instance.c trunk/varnish-cache/lib/libvarnishapi/shmlog.c trunk/varnish-cache/lib/libvarnishcompat/Makefile.am trunk/varnish-cache/lib/libvarnishcompat/asprintf.c trunk/varnish-cache/lib/libvarnishcompat/daemon.c trunk/varnish-cache/lib/libvarnishcompat/setproctitle.c trunk/varnish-cache/lib/libvarnishcompat/srandomdev.c trunk/varnish-cache/lib/libvarnishcompat/strlcat.c trunk/varnish-cache/lib/libvarnishcompat/strlcpy.c trunk/varnish-cache/lib/libvarnishcompat/strndup.c trunk/varnish-cache/lib/libvarnishcompat/vasprintf.c trunk/varnish-cache/lib/libvarnishcompat/vis.c trunk/varnish-cache/lib/libvcl/Makefile.am trunk/varnish-cache/lib/libvcl/vcc_acl.c trunk/varnish-cache/lib/libvcl/vcc_action.c trunk/varnish-cache/lib/libvcl/vcc_backend.c trunk/varnish-cache/lib/libvcl/vcc_compile.c trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl trunk/varnish-cache/lib/libvcl/vcc_parse.c trunk/varnish-cache/lib/libvcl/vcc_string.c trunk/varnish-cache/lib/libvcl/vcc_token.c trunk/varnish-cache/lib/libvcl/vcc_var.c trunk/varnish-cache/lib/libvcl/vcc_xref.c Log: Use #include "config.h" instead of -include config.h Modified: trunk/varnish-cache/bin/varnishadm/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishadm/Makefile.am 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishadm/Makefile.am 2008-02-13 13:55:39 UTC (rev 2455) @@ -8,8 +8,6 @@ varnishadm_SOURCES = \ varnishadm.c - -varnishadm_CFLAGS = -include config.h varnishadm_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ Modified: trunk/varnish-cache/bin/varnishadm/varnishadm.c =================================================================== --- trunk/varnish-cache/bin/varnishadm/varnishadm.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishadm/varnishadm.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishd/Makefile.am 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/Makefile.am 2008-02-13 13:55:39 UTC (rev 2455) @@ -64,7 +64,7 @@ steps.h \ stevedore.h -varnishd_CFLAGS = -include config.h \ +varnishd_CFLAGS = \ -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' varnishd_LDFLAGS = -export-dynamic Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -33,6 +33,8 @@ * write the session pointer to a pipe which the event engine monitors. */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_epoll.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_epoll.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_epoll.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -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: trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -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: trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -30,6 +30,8 @@ * */ +#include "config.h" + #if defined(HAVE_POLL) #include Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -66,6 +66,8 @@ * */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_ban.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_ban.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_ban.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -31,6 +31,8 @@ * Ban processing */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -56,6 +56,8 @@ DOT acceptor -> start [style=bold,color=green,weight=4] */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_dir_random.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_dir_random.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_dir_random.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -30,6 +30,8 @@ * */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_dir_simple.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_dir_simple.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_dir_simple.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -30,6 +30,8 @@ * */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_expire.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_expire.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -38,6 +38,8 @@ * XXX: are ready. */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_hash.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -52,6 +52,8 @@ * not busy only once. */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_http.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_http.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -31,6 +31,8 @@ * HTTP request storage and manipulation */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_httpconn.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_httpconn.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_httpconn.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -31,6 +31,8 @@ * HTTP protocol requests */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_main.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_main.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_main.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_panic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_panic.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_panic.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pipe.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_pipe.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -31,6 +31,8 @@ * XXX: charge bytes to srcaddr */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pool.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -31,6 +31,8 @@ * XXX: automatic thread-pool size adaptation. */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_response.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_response.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_session.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_session.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_session.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -48,6 +48,8 @@ * XXX: we still have to do the source-addr lookup. */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_synthetic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_synthetic.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_synthetic.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -28,6 +28,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_vary.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vary.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_vary.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -54,6 +54,8 @@ * '\0' */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_vcl.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vcl.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_vcl.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -33,6 +33,8 @@ * The interface *from* the compiled VCL code is in cache_vrt.c. */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -31,6 +31,8 @@ * Runtime support for compiled VCL programs */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -34,6 +34,8 @@ * XXX: a refresh facility. */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -40,6 +40,8 @@ * hanging, esi:include */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_re.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt_re.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_vrt_re.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -31,6 +31,8 @@ * Runtime support for compiled VCL programs, regexps */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/bin/varnishd/cache_ws.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_ws.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/cache_ws.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -30,6 +30,8 @@ * */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_classic.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/hash_classic.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -31,6 +31,8 @@ * A classic bucketed hash */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/hash_simple_list.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_simple_list.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/hash_simple_list.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -31,6 +31,8 @@ * This is the reference hash(/lookup) implementation */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -31,6 +31,8 @@ * The mechanics of handling the child process */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -31,6 +31,8 @@ * The management process' CLI handling */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/bin/varnishd/mgt_event.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_event.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/mgt_event.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -31,6 +31,8 @@ * VCL compiler stuff */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/bin/varnishd/rfc2616.c =================================================================== --- trunk/varnish-cache/bin/varnishd/rfc2616.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/rfc2616.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/bin/varnishd/shmlog.c =================================================================== --- trunk/varnish-cache/bin/varnishd/shmlog.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/shmlog.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/stevedore.c =================================================================== --- trunk/varnish-cache/bin/varnishd/stevedore.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/stevedore.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -28,6 +28,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/storage_file.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_file.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/storage_file.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -31,6 +31,8 @@ * Storage method based on mmap'ed file */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishd/storage_malloc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_malloc.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/storage_malloc.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -31,6 +31,8 @@ * Storage method based on malloc(3) */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/bin/varnishd/tcp.c =================================================================== --- trunk/varnish-cache/bin/varnishd/tcp.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/tcp.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -31,6 +31,8 @@ * The management process and CLI handling */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/bin/varnishhist/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishhist/Makefile.am 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishhist/Makefile.am 2008-02-13 13:55:39 UTC (rev 2455) @@ -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: trunk/varnish-cache/bin/varnishhist/varnishhist.c =================================================================== --- trunk/varnish-cache/bin/varnishhist/varnishhist.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishhist/varnishhist.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -32,6 +32,8 @@ * Log tailer for Varnish */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishlog/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishlog/Makefile.am 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishlog/Makefile.am 2008-02-13 13:55:39 UTC (rev 2455) @@ -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: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -31,6 +31,8 @@ * Log tailer for Varnish */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishncsa/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishncsa/Makefile.am 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishncsa/Makefile.am 2008-02-13 13:55:39 UTC (rev 2455) @@ -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: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -59,6 +59,8 @@ * - Maybe rotate/compress log */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishreplay/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishreplay/Makefile.am 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishreplay/Makefile.am 2008-02-13 13:55:39 UTC (rev 2455) @@ -8,8 +8,6 @@ varnishreplay_SOURCES = \ varnishreplay.c - -varnishreplay_CFLAGS = -include config.h varnishreplay_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ Modified: trunk/varnish-cache/bin/varnishreplay/varnishreplay.c =================================================================== --- trunk/varnish-cache/bin/varnishreplay/varnishreplay.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishreplay/varnishreplay.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -28,6 +28,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishstat/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishstat/Makefile.am 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishstat/Makefile.am 2008-02-13 13:55:39 UTC (rev 2455) @@ -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: trunk/varnish-cache/bin/varnishstat/varnishstat.c =================================================================== --- trunk/varnish-cache/bin/varnishstat/varnishstat.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishstat/varnishstat.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -32,6 +32,8 @@ * Log tailer for Varnish */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/bin/varnishtop/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishtop/Makefile.am 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishtop/Makefile.am 2008-02-13 13:55:39 UTC (rev 2455) @@ -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: trunk/varnish-cache/bin/varnishtop/varnishtop.c =================================================================== --- trunk/varnish-cache/bin/varnishtop/varnishtop.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/bin/varnishtop/varnishtop.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -32,6 +32,8 @@ * Log tailer for Varnish */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/lib/libvarnish/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libvarnish/Makefile.am 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnish/Makefile.am 2008-02-13 13:55:39 UTC (rev 2455) @@ -20,8 +20,6 @@ vss.c \ vtmpfile.c -libvarnish_la_CFLAGS = -include config.h - libvarnish_la_LIBADD = ${RT_LIBS} ${NET_LIBS} TESTS = num_c_test Modified: trunk/varnish-cache/lib/libvarnish/argv.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/argv.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnish/argv.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -38,6 +38,8 @@ * */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/lib/libvarnish/assert.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/assert.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnish/assert.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/lib/libvarnish/binary_heap.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/binary_heap.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnish/binary_heap.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -36,6 +36,8 @@ * XXX: the array is not scaled back when items are deleted. */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/lib/libvarnish/cli.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/cli.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnish/cli.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -31,6 +31,8 @@ * Stuff for handling the CLI protocol */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/lib/libvarnish/cli_common.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/cli_common.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnish/cli_common.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/lib/libvarnish/crc32.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/crc32.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnish/crc32.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -31,6 +31,8 @@ * This CRC32 implementation is in the public domain. */ +#include "config.h" + #include "libvarnish.h" /*--------------------------------------------------------------------*/ Modified: trunk/varnish-cache/lib/libvarnish/flopen.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/flopen.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnish/flopen.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -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: trunk/varnish-cache/lib/libvarnish/num.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/num.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnish/num.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -30,6 +30,8 @@ * Deal with numbers with data storage suffix scaling */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/lib/libvarnish/time.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/time.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnish/time.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -46,6 +46,8 @@ * */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/lib/libvarnish/version.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/version.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnish/version.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -31,6 +31,8 @@ * Display a standardized version message. */ +#include "config.h" + #include #include "libvarnish.h" Modified: trunk/varnish-cache/lib/libvarnish/vpf.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/vpf.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnish/vpf.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -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: trunk/varnish-cache/lib/libvarnish/vsb.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/vsb.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnish/vsb.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -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: trunk/varnish-cache/lib/libvarnish/vss.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/vss.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnish/vss.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -30,6 +30,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/lib/libvarnish/vtmpfile.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/vtmpfile.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnish/vtmpfile.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/lib/libvarnishapi/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/Makefile.am 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnishapi/Makefile.am 2008-02-13 13:55:39 UTC (rev 2455) @@ -9,5 +9,5 @@ instance.c \ shmlog.c -libvarnishapi_la_CFLAGS = -include config.h \ +libvarnishapi_la_CFLAGS = \ -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' Modified: trunk/varnish-cache/lib/libvarnishapi/base64.c =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/base64.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnishapi/base64.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -6,6 +6,8 @@ * $Id$ */ +#include "config.h" + #include #include #include "varnishapi.h" Modified: trunk/varnish-cache/lib/libvarnishapi/instance.c =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/instance.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnishapi/instance.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -28,6 +28,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/lib/libvarnishcompat/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libvarnishcompat/Makefile.am 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnishcompat/Makefile.am 2008-02-13 13:55:39 UTC (rev 2455) @@ -14,5 +14,3 @@ strlcpy.c \ strndup.c \ vis.c - -libvarnishcompat_la_CFLAGS = -include config.h Modified: trunk/varnish-cache/lib/libvarnishcompat/asprintf.c =================================================================== --- trunk/varnish-cache/lib/libvarnishcompat/asprintf.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnishcompat/asprintf.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -30,6 +30,8 @@ * */ +#include "config.h" + #ifndef HAVE_ASPRINTF #include Modified: trunk/varnish-cache/lib/libvarnishcompat/daemon.c =================================================================== --- trunk/varnish-cache/lib/libvarnishcompat/daemon.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnishcompat/daemon.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -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: trunk/varnish-cache/lib/libvarnishcompat/setproctitle.c =================================================================== --- trunk/varnish-cache/lib/libvarnishcompat/setproctitle.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnishcompat/setproctitle.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #ifndef HAVE_SETPROCTITLE #include Modified: trunk/varnish-cache/lib/libvarnishcompat/srandomdev.c =================================================================== --- trunk/varnish-cache/lib/libvarnishcompat/srandomdev.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnishcompat/srandomdev.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #ifndef HAVE_SRANDOMDEV #include Modified: trunk/varnish-cache/lib/libvarnishcompat/strlcat.c =================================================================== --- trunk/varnish-cache/lib/libvarnishcompat/strlcat.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnishcompat/strlcat.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -17,6 +17,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" + #ifndef HAVE_STRLCAT #include Modified: trunk/varnish-cache/lib/libvarnishcompat/strlcpy.c =================================================================== --- trunk/varnish-cache/lib/libvarnishcompat/strlcpy.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnishcompat/strlcpy.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -17,6 +17,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" + #ifndef HAVE_STRLCPY #include Modified: trunk/varnish-cache/lib/libvarnishcompat/strndup.c =================================================================== --- trunk/varnish-cache/lib/libvarnishcompat/strndup.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnishcompat/strndup.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -30,6 +30,8 @@ * */ +#include "config.h" + #ifndef HAVE_STRNDUP #include Modified: trunk/varnish-cache/lib/libvarnishcompat/vasprintf.c =================================================================== --- trunk/varnish-cache/lib/libvarnishcompat/vasprintf.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnishcompat/vasprintf.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -30,6 +30,8 @@ * */ +#include "config.h" + #ifndef HAVE_VASPRINTF #include Modified: trunk/varnish-cache/lib/libvarnishcompat/vis.c =================================================================== --- trunk/varnish-cache/lib/libvarnishcompat/vis.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvarnishcompat/vis.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -31,6 +31,8 @@ * $Id$ */ +#include "config.h" + #if !defined(HAVE_VIS) || !defined(HAVE_STRVIS) || !defined(HAVE_STRVISX) #include Modified: trunk/varnish-cache/lib/libvcl/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libvcl/Makefile.am 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvcl/Makefile.am 2008-02-13 13:55:39 UTC (rev 2455) @@ -20,5 +20,3 @@ vcc_token.c \ vcc_var.c \ vcc_xref.c - -libvcl_la_CFLAGS = -include config.h Modified: trunk/varnish-cache/lib/libvcl/vcc_acl.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_acl.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvcl/vcc_acl.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_action.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvcl/vcc_action.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include "vsb.h" Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -60,6 +60,8 @@ * and all the rest... */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -6,6 +6,8 @@ * Edit vcc_gen_fixed_token.tcl instead */ +#include "config.h" + #include #include #include "vcc_priv.h" Modified: trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl 2008-02-13 13:55:39 UTC (rev 2455) @@ -305,6 +305,7 @@ puts $fo "\t{ NULL }" } +puts $fo "#include \"config.h\"" puts $fo "#include " puts $fo "#include \"vcc_compile.h\"" puts $fo "" Modified: trunk/varnish-cache/lib/libvcl/vcc_parse.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_parse.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvcl/vcc_parse.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/lib/libvcl/vcc_string.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_string.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvcl/vcc_string.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/lib/libvcl/vcc_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_token.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvcl/vcc_token.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/lib/libvcl/vcc_var.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_var.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvcl/vcc_var.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -29,6 +29,8 @@ * $Id$ */ +#include "config.h" + #include #include Modified: trunk/varnish-cache/lib/libvcl/vcc_xref.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_xref.c 2008-02-13 13:29:40 UTC (rev 2454) +++ trunk/varnish-cache/lib/libvcl/vcc_xref.c 2008-02-13 13:55:39 UTC (rev 2455) @@ -39,6 +39,8 @@ * they are called. */ +#include "config.h" + #include #include "vsb.h" From des at projects.linpro.no Wed Feb 13 14:58:48 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Wed, 13 Feb 2008 15:58:48 +0100 (CET) Subject: r2456 - in trunk/varnish-cache: . bin Message-ID: <20080213145848.9DB431EC454@projects.linpro.no> Author: des Date: 2008-02-13 15:58:48 +0100 (Wed, 13 Feb 2008) New Revision: 2456 Modified: trunk/varnish-cache/bin/Makefile.am trunk/varnish-cache/configure.ac Log: Disable tools that require curses if no curses library was found. Modified: trunk/varnish-cache/bin/Makefile.am =================================================================== --- trunk/varnish-cache/bin/Makefile.am 2008-02-13 13:55:39 UTC (rev 2455) +++ trunk/varnish-cache/bin/Makefile.am 2008-02-13 14:58:48 UTC (rev 2456) @@ -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: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2008-02-13 13:55:39 UTC (rev 2455) +++ trunk/varnish-cache/configure.ac 2008-02-13 14:58:48 UTC (rev 2456) @@ -38,15 +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) - -# people tend to forget about curses until the build breaks -if test "$ac_cv_search_initscr" = no; then - AC_MSG_ERROR([curses or ncurses is required]) +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="" From des at projects.linpro.no Wed Feb 13 17:10:04 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Wed, 13 Feb 2008 18:10:04 +0100 (CET) Subject: r2457 - trunk/varnish-cache/bin/varnishncsa Message-ID: <20080213171004.D99ED1EC35F@projects.linpro.no> Author: des Date: 2008-02-13 18:10:04 +0100 (Wed, 13 Feb 2008) New Revision: 2457 Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c Log: SLT_Length is not relevant for backend requests. Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2008-02-13 14:58:48 UTC (rev 2456) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2008-02-13 17:10:04 UTC (rev 2457) @@ -243,13 +243,6 @@ lp->df_Host = trimline(next, end); break; - case SLT_Length: - if (lp->df_b != NULL) - lp->bogus = 1; - else - lp->df_b = trimline(ptr, end); - break; - case SLT_BackendReuse: case SLT_BackendClose: /* got it all */ From des at projects.linpro.no Wed Feb 13 17:12:59 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Wed, 13 Feb 2008 18:12:59 +0100 (CET) Subject: r2458 - trunk/varnish-cache Message-ID: <20080213171259.B227F1EC6BC@projects.linpro.no> Author: des Date: 2008-02-13 18:12:59 +0100 (Wed, 13 Feb 2008) New Revision: 2458 Modified: trunk/varnish-cache/autogen.des Log: Enable tests + allow overrides from command line. Modified: trunk/varnish-cache/autogen.des =================================================================== --- trunk/varnish-cache/autogen.des 2008-02-13 17:10:04 UTC (rev 2457) +++ trunk/varnish-cache/autogen.des 2008-02-13 17:12:59 UTC (rev 2458) @@ -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 \ + "$@" From des at projects.linpro.no Wed Feb 13 17:19:52 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Wed, 13 Feb 2008 18:19:52 +0100 (CET) Subject: r2459 - trunk/varnish-cache/lib/libvarnish Message-ID: <20080213171952.B83C81EC35F@projects.linpro.no> Author: des Date: 2008-02-13 18:19:52 +0100 (Wed, 13 Feb 2008) New Revision: 2459 Modified: trunk/varnish-cache/lib/libvarnish/Makefile.am trunk/varnish-cache/lib/libvarnish/num.c Log: Never mind trying to avoid libm, we already use it anyway. Modified: trunk/varnish-cache/lib/libvarnish/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libvarnish/Makefile.am 2008-02-13 17:12:59 UTC (rev 2458) +++ trunk/varnish-cache/lib/libvarnish/Makefile.am 2008-02-13 17:19:52 UTC (rev 2459) @@ -20,7 +20,7 @@ vss.c \ vtmpfile.c -libvarnish_la_LIBADD = ${RT_LIBS} ${NET_LIBS} +libvarnish_la_LIBADD = ${RT_LIBS} ${NET_LIBS} ${LIBM} TESTS = num_c_test @@ -29,6 +29,7 @@ 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 Modified: trunk/varnish-cache/lib/libvarnish/num.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/num.c 2008-02-13 17:12:59 UTC (rev 2458) +++ trunk/varnish-cache/lib/libvarnish/num.c 2008-02-13 17:19:52 UTC (rev 2459) @@ -98,8 +98,7 @@ return ("Invalid suffix"); } - /* intentionally not round(fval) to avoid need for -lm */ - *r = (uintmax_t)(fval + 0.5); + *r = (uintmax_t)round(fval); return (NULL); } From des at projects.linpro.no Wed Feb 13 17:25:52 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Wed, 13 Feb 2008 18:25:52 +0100 (CET) Subject: r2460 - trunk/varnish-cache/lib/libvcl Message-ID: <20080213172552.EEBE81EC454@projects.linpro.no> Author: des Date: 2008-02-13 18:25:52 +0100 (Wed, 13 Feb 2008) New Revision: 2460 Modified: trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl Log: Forgot config.h here Modified: trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl 2008-02-13 17:19:52 UTC (rev 2459) +++ trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl 2008-02-13 17:25:52 UTC (rev 2460) @@ -217,6 +217,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\"" From des at projects.linpro.no Wed Feb 13 17:25:57 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Wed, 13 Feb 2008 18:25:57 +0100 (CET) Subject: r2461 - trunk/varnish-cache/lib/libvcl Message-ID: <20080213172557.6EDF41EC6C0@projects.linpro.no> Author: des Date: 2008-02-13 18:25:57 +0100 (Wed, 13 Feb 2008) New Revision: 2461 Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c trunk/varnish-cache/lib/libvcl/vcc_obj.c Log: Regenerate Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-02-13 17:25:52 UTC (rev 2460) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-02-13 17:25:57 UTC (rev 2461) @@ -7,7 +7,6 @@ */ #include "config.h" - #include #include #include "vcc_priv.h" Modified: trunk/varnish-cache/lib/libvcl/vcc_obj.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_obj.c 2008-02-13 17:25:52 UTC (rev 2460) +++ trunk/varnish-cache/lib/libvcl/vcc_obj.c 2008-02-13 17:25:57 UTC (rev 2461) @@ -6,6 +6,7 @@ * Edit vcc_gen_obj.tcl instead */ +#include "config.h" #include #include "vcc_compile.h" From des at projects.linpro.no Fri Feb 15 07:51:15 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Fri, 15 Feb 2008 08:51:15 +0100 (CET) Subject: r2462 - trunk/varnish-cache/bin/varnishd Message-ID: <20080215075115.9D7641EC484@projects.linpro.no> Author: des Date: 2008-02-15 08:51:15 +0100 (Fri, 15 Feb 2008) New Revision: 2462 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c Log: Detect and gracefully recover from what appears to be a bug in the FreeBSD kernel, which will sometimes report a null kqueue event. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2008-02-13 17:25:57 UTC (rev 2461) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2008-02-15 07:51:15 UTC (rev 2462) @@ -219,7 +219,13 @@ sp, (unsigned long)kp->data, kp->flags, (kp->flags & EV_EOF) ? " EOF" : ""); #endif - assert(sp->fd == kp->ident); + spassert(sp->id == kp->ident); + spassert(sp->fd == sp->id || sp->fd == -1); + if (sp->fd == -1) { + VSL(SLT_Debug, sp->id, "%s(): got event 0x%04x on closed fd", + __func__, kp->fflags); + return; + } if (kp->data > 0) { i = HTC_Rx(sp->htc); if (i == 0) From phk at projects.linpro.no Fri Feb 15 08:33:41 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 09:33:41 +0100 (CET) Subject: r2463 - trunk/varnish-cache/lib/libvarnish Message-ID: <20080215083341.ECDCA1EC35F@projects.linpro.no> Author: phk Date: 2008-02-15 09:33:41 +0100 (Fri, 15 Feb 2008) New Revision: 2463 Modified: trunk/varnish-cache/lib/libvarnish/num.c Log: Put a ULL suffix on numeric constants too large for 32 bit systems. Modified: trunk/varnish-cache/lib/libvarnish/num.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/num.c 2008-02-15 07:51:15 UTC (rev 2462) +++ trunk/varnish-cache/lib/libvarnish/num.c 2008-02-15 08:33:41 UTC (rev 2463) @@ -137,11 +137,11 @@ { "1.3GB", (uintmax_t)0, (uintmax_t)1395864371 }, { "1.7GB", (uintmax_t)0, (uintmax_t)1825361101 }, - { "1099511627776", (uintmax_t)0, (uintmax_t)1099511627776 }, + { "1099511627776", (uintmax_t)0, (uintmax_t)1099511627776ULL }, { "1T", (uintmax_t)0, (uintmax_t)1<<40 }, { "1TB", (uintmax_t)0, (uintmax_t)1<<40 }, - { "1.3TB", (uintmax_t)0, (uintmax_t)1429365116109 }, - { "1.7TB", (uintmax_t)0, (uintmax_t)1869169767219 }, + { "1.3TB", (uintmax_t)0, (uintmax_t)1429365116109ULL }, + { "1.7TB", (uintmax_t)0, (uintmax_t)1869169767219ULL }, { "1%", (uintmax_t)1024, (uintmax_t)10 }, { "2%", (uintmax_t)1024, (uintmax_t)20 }, From phk at projects.linpro.no Fri Feb 15 08:54:20 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 09:54:20 +0100 (CET) Subject: r2464 - trunk/varnish-cache/bin/varnishd Message-ID: <20080215085420.3EF841EC2A4@projects.linpro.no> Author: phk Date: 2008-02-15 09:54:20 +0100 (Fri, 15 Feb 2008) New Revision: 2464 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_backend.c trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/bin/varnishd/cache_http.c Log: Determine our backend (using the director) before we filter the req into the bereq, in order to be able to assign a default Host: header if there is none. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-02-15 08:33:41 UTC (rev 2463) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-02-15 08:54:20 UTC (rev 2464) @@ -415,6 +415,8 @@ void VBE_DropRef(struct backend *); struct backend *VBE_AddBackend(struct cli *cli, const struct vrt_backend *vb); void VBE_UpdateHealth(const struct sess *sp, const struct vbe_conn *, int); +void VBE_AddHostHeader(struct sess *sp); +void VBE_SelectBackend(struct sess *sp); /* cache_ban.c */ void AddBan(const char *, int hash); Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend.c 2008-02-15 08:33:41 UTC (rev 2463) +++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2008-02-15 08:54:20 UTC (rev 2464) @@ -123,6 +123,21 @@ VTAILQ_HEAD_INITIALIZER(backends); /*-------------------------------------------------------------------- + * Create default Host: header for backend request + */ +void +VBE_AddHostHeader(struct sess *sp) +{ + + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + CHECK_OBJ_NOTNULL(sp->bereq, BEREQ_MAGIC); + CHECK_OBJ_NOTNULL(sp->bereq->http, HTTP_MAGIC); + CHECK_OBJ_NOTNULL(sp->backend, BACKEND_MAGIC); + http_PrintfHeader(sp->wrk, sp->fd, sp->bereq->http, + "Host: %s", sp->backend->vrt->hostname); +} + +/*-------------------------------------------------------------------- * Attempt to connect to a given addrinfo entry. * * Must be called with locked backend, but will release the backend @@ -406,18 +421,29 @@ /*--------------------------------------------------------------------*/ -struct vbe_conn * -VBE_GetFd(struct sess *sp) +void +VBE_SelectBackend(struct sess *sp) { struct backend *bp; - struct vbe_conn *vc; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp->director, DIRECTOR_MAGIC); bp = sp->director->choose(sp); CHECK_OBJ_NOTNULL(bp, BACKEND_MAGIC); sp->backend = bp; +} +/*--------------------------------------------------------------------*/ + +struct vbe_conn * +VBE_GetFd(struct sess *sp) +{ + struct backend *bp; + struct vbe_conn *vc; + + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + bp = sp->backend; + /* first look for vbe_conn's we can recycle */ while (1) { LOCK(&bp->mtx); Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2008-02-15 08:33:41 UTC (rev 2463) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2008-02-15 08:54:20 UTC (rev 2464) @@ -617,6 +617,7 @@ CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC); + VBE_SelectBackend(sp); http_FilterHeader(sp, HTTPH_R_FETCH); VCL_miss_method(sp); if (sp->handling == VCL_RET_ERROR) { @@ -680,6 +681,7 @@ CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC); AZ(sp->obj); + VBE_SelectBackend(sp); http_FilterHeader(sp, HTTPH_R_PASS); VCL_pass_method(sp); @@ -729,6 +731,7 @@ CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC); sp->wrk->acct.pipe++; + VBE_SelectBackend(sp); http_FilterHeader(sp, HTTPH_R_PIPE); VCL_pipe_method(sp); Modified: trunk/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_http.c 2008-02-15 08:33:41 UTC (rev 2463) +++ trunk/varnish-cache/bin/varnishd/cache_http.c 2008-02-15 08:54:20 UTC (rev 2464) @@ -649,15 +649,11 @@ http_PrintfHeader(sp->wrk, sp->fd, hp, "X-Forwarded-for: %s", sp->addr); - /* XXX: This really ought to go into the default VCL */ - if (!http_GetHdr(hp, H_Host, &b)) { -#if 0 - http_PrintfHeader(sp->wrk, sp->fd, hp, "Host: %s", - sp->backend->method->gethostname(sp->backend)); -#endif - INCOMPL(); - } sp->bereq = bereq; + + /* XXX: This possibly ought to go into the default VCL */ + if (!http_GetHdr(hp, H_Host, &b)) + VBE_AddHostHeader(sp); } /*-------------------------------------------------------------------- From phk at projects.linpro.no Fri Feb 15 09:09:47 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 10:09:47 +0100 (CET) Subject: r2465 - trunk/varnish-cache/bin/varnishd Message-ID: <20080215090947.8DB4F1EC35F@projects.linpro.no> Author: phk Date: 2008-02-15 10:09:47 +0100 (Fri, 15 Feb 2008) New Revision: 2465 Modified: trunk/varnish-cache/bin/varnishd/flint.lnt trunk/varnish-cache/bin/varnishd/flint.sh Log: Adjust to direct inclusion of config.h Modified: trunk/varnish-cache/bin/varnishd/flint.lnt =================================================================== --- trunk/varnish-cache/bin/varnishd/flint.lnt 2008-02-15 08:54:20 UTC (rev 2464) +++ trunk/varnish-cache/bin/varnishd/flint.lnt 2008-02-15 09:09:47 UTC (rev 2465) @@ -9,7 +9,7 @@ -emacro(736, isnan) // isnanf --header(../../config.h) +// -header(../../config.h) // Fix strchr() semtics, it can only return NULL if arg2 != 0 -sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 )) Modified: trunk/varnish-cache/bin/varnishd/flint.sh =================================================================== --- trunk/varnish-cache/bin/varnishd/flint.sh 2008-02-15 08:54:20 UTC (rev 2464) +++ trunk/varnish-cache/bin/varnishd/flint.sh 2008-02-15 09:09:47 UTC (rev 2465) @@ -5,6 +5,7 @@ -I/usr/include \ -I. \ -I../../include \ + -I../.. \ flint.lnt \ *.c > $T 2>&1 From phk at projects.linpro.no Fri Feb 15 09:41:24 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 10:41:24 +0100 (CET) Subject: r2466 - trunk/varnish-cache/bin/varnishd Message-ID: <20080215094124.2044C1EC2A4@projects.linpro.no> Author: phk Date: 2008-02-15 10:41:23 +0100 (Fri, 15 Feb 2008) New Revision: 2466 Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c Log: Give the param structure a void *priv, and use it to avoid a large number of pointless trivial functions for bools and timeouts. Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-02-15 09:09:47 UTC (rev 2465) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-02-15 09:41:23 UTC (rev 2466) @@ -57,11 +57,12 @@ struct parspec; -typedef void tweak_t(struct cli *, struct parspec *, const char *arg); +typedef void tweak_t(struct cli *, const struct parspec *, const char *arg); struct parspec { const char *name; tweak_t *func; + volatile void *priv; const char *descr; int flags; #define DELAYED_EFFECT 1 @@ -96,6 +97,18 @@ /*--------------------------------------------------------------------*/ static void +tweak_timeout(struct cli *cli, const struct parspec *par, const char *arg) +{ + volatile unsigned *dest; + + dest = par->priv; + tweak_generic_timeout(cli, dest, arg); +} + + +/*--------------------------------------------------------------------*/ + +static void tweak_generic_bool(struct cli *cli, volatile unsigned *dest, const char *arg) { if (arg != NULL) { @@ -123,6 +136,17 @@ /*--------------------------------------------------------------------*/ static void +tweak_bool(struct cli *cli, const struct parspec *par, const char *arg) +{ + volatile unsigned *dest; + + dest = par->priv; + tweak_generic_bool(cli, dest, arg); +} + +/*--------------------------------------------------------------------*/ + +static void tweak_generic_uint(struct cli *cli, volatile unsigned *dest, const char *arg, unsigned min, unsigned max) { unsigned u; @@ -159,7 +183,7 @@ */ static void -tweak_user(struct cli *cli, struct parspec *par, const char *arg) +tweak_user(struct cli *cli, const struct parspec *par, const char *arg) { struct passwd *pw; struct group *gr; @@ -200,7 +224,7 @@ */ static void -tweak_group(struct cli *cli, struct parspec *par, const char *arg) +tweak_group(struct cli *cli, const struct parspec *par, const char *arg) { struct group *gr; @@ -233,7 +257,7 @@ /*--------------------------------------------------------------------*/ static void -tweak_default_ttl(struct cli *cli, struct parspec *par, const char *arg) +tweak_default_ttl(struct cli *cli, const struct parspec *par, const char *arg) { (void)par; @@ -243,7 +267,7 @@ /*--------------------------------------------------------------------*/ static void -tweak_thread_pools(struct cli *cli, struct parspec *par, const char *arg) +tweak_thread_pools(struct cli *cli, const struct parspec *par, const char *arg) { (void)par; @@ -255,7 +279,7 @@ /*--------------------------------------------------------------------*/ static void -tweak_thread_pool_min(struct cli *cli, struct parspec *par, const char *arg) +tweak_thread_pool_min(struct cli *cli, const struct parspec *par, const char *arg) { (void)par; @@ -266,7 +290,7 @@ /*--------------------------------------------------------------------*/ static void -tweak_thread_pool_max(struct cli *cli, struct parspec *par, const char *arg) +tweak_thread_pool_max(struct cli *cli, const struct parspec *par, const char *arg) { (void)par; @@ -277,27 +301,17 @@ /*--------------------------------------------------------------------*/ static void -tweak_thread_pool_timeout(struct cli *cli, struct parspec *par, const char *arg) +tweak_overflow_max(struct cli *cli, const struct parspec *par, const char *arg) { (void)par; - tweak_generic_timeout(cli, &master.wthread_timeout, arg); -} - -/*--------------------------------------------------------------------*/ - -static void -tweak_overflow_max(struct cli *cli, struct parspec *par, const char *arg) -{ - - (void)par; tweak_generic_uint(cli, &master.overflow_max, arg, 0, UINT_MAX); } /*--------------------------------------------------------------------*/ static void -tweak_rush_exponent(struct cli *cli, struct parspec *par, const char *arg) +tweak_rush_exponent(struct cli *cli, const struct parspec *par, const char *arg) { (void)par; @@ -308,7 +322,7 @@ /*--------------------------------------------------------------------*/ static void -tweak_http_workspace(struct cli *cli, struct parspec *par, const char *arg) +tweak_http_workspace(struct cli *cli, const struct parspec *par, const char *arg) { (void)par; @@ -319,56 +333,10 @@ /*--------------------------------------------------------------------*/ static void -tweak_sess_timeout(struct cli *cli, struct parspec *par, const char *arg) +tweak_fetch_chunksize(struct cli *cli, const struct parspec *par, const char *arg) { - (void)par; - tweak_generic_timeout(cli, &master.sess_timeout, arg); -} -/*--------------------------------------------------------------------*/ - -static void -tweak_pipe_timeout(struct cli *cli, struct parspec *par, const char *arg) -{ (void)par; - tweak_generic_timeout(cli, &master.pipe_timeout, arg); -} - -/*--------------------------------------------------------------------*/ - -static void -tweak_send_timeout(struct cli *cli, struct parspec *par, const char *arg) -{ - (void)par; - tweak_generic_timeout(cli, &master.send_timeout, arg); -} - -/*--------------------------------------------------------------------*/ - -static void -tweak_lru_timeout(struct cli *cli, struct parspec *par, const char *arg) -{ - (void)par; - tweak_generic_timeout(cli, &master.lru_timeout, arg); -} - -/*--------------------------------------------------------------------*/ - -static void -tweak_auto_restart(struct cli *cli, struct parspec *par, const char *arg) -{ - - (void)par; - tweak_generic_bool(cli, &master.auto_restart, arg); -} - -/*--------------------------------------------------------------------*/ - -static void -tweak_fetch_chunksize(struct cli *cli, struct parspec *par, const char *arg) -{ - - (void)par; tweak_generic_uint(cli, &master.fetch_chunksize, arg, 4, UINT_MAX / 1024); } @@ -377,7 +345,7 @@ /*--------------------------------------------------------------------*/ static void -tweak_sendfile_threshold(struct cli *cli, struct parspec *par, const char *arg) +tweak_sendfile_threshold(struct cli *cli, const struct parspec *par, const char *arg) { (void)par; @@ -387,13 +355,6 @@ /*--------------------------------------------------------------------*/ -static void -tweak_vcl_trace(struct cli *cli, struct parspec *par, const char *arg) -{ - (void)par; - tweak_generic_bool(cli, &master.vcl_trace, arg); -} - /*--------------------------------------------------------------------*/ static void @@ -409,7 +370,7 @@ } static void -tweak_listen_address(struct cli *cli, struct parspec *par, const char *arg) +tweak_listen_address(struct cli *cli, const struct parspec *par, const char *arg) { char **av; int i; @@ -489,7 +450,7 @@ /*--------------------------------------------------------------------*/ static void -tweak_listen_depth(struct cli *cli, struct parspec *par, const char *arg) +tweak_listen_depth(struct cli *cli, const struct parspec *par, const char *arg) { (void)par; tweak_generic_uint(cli, &master.listen_depth, arg, 0, UINT_MAX); @@ -498,7 +459,7 @@ /*--------------------------------------------------------------------*/ static void -tweak_srcaddr_hash(struct cli *cli, struct parspec *par, const char *arg) +tweak_srcaddr_hash(struct cli *cli, const struct parspec *par, const char *arg) { (void)par; tweak_generic_uint(cli, &master.srcaddr_hash, arg, 63, UINT_MAX); @@ -507,7 +468,7 @@ /*--------------------------------------------------------------------*/ static void -tweak_srcaddr_ttl(struct cli *cli, struct parspec *par, const char *arg) +tweak_srcaddr_ttl(struct cli *cli, const struct parspec *par, const char *arg) { (void)par; tweak_generic_uint(cli, &master.srcaddr_ttl, arg, 0, UINT_MAX); @@ -516,43 +477,16 @@ /*--------------------------------------------------------------------*/ static void -tweak_backend_http11(struct cli *cli, struct parspec *par, const char *arg) +tweak_ping_interval(struct cli *cli, const struct parspec *par, const char *arg) { (void)par; - tweak_generic_bool(cli, &master.backend_http11, arg); -} - -/*--------------------------------------------------------------------*/ - -static void -tweak_client_http11(struct cli *cli, struct parspec *par, const char *arg) -{ - (void)par; - tweak_generic_bool(cli, &master.client_http11, arg); -} - -/*--------------------------------------------------------------------*/ - -static void -tweak_cli_timeout(struct cli *cli, struct parspec *par, const char *arg) -{ - (void)par; - tweak_generic_timeout(cli, &master.cli_timeout, arg); -} - -/*--------------------------------------------------------------------*/ - -static void -tweak_ping_interval(struct cli *cli, struct parspec *par, const char *arg) -{ - (void)par; tweak_generic_uint(cli, &master.ping_interval, arg, 0, UINT_MAX); } /*--------------------------------------------------------------------*/ static void -tweak_cc_command(struct cli *cli, struct parspec *par, const char *arg) +tweak_cc_command(struct cli *cli, const struct parspec *par, const char *arg) { /* XXX should have tweak_generic_string */ @@ -567,7 +501,7 @@ } static void -tweak_max_restarts(struct cli *cli, struct parspec *par, const char *arg) +tweak_max_restarts(struct cli *cli, const struct parspec *par, const char *arg) { (void)par; @@ -575,20 +509,13 @@ } static void -tweak_max_esi_includes(struct cli *cli, struct parspec *par, const char *arg) +tweak_max_esi_includes(struct cli *cli, const struct parspec *par, const char *arg) { (void)par; tweak_generic_uint(cli, &master.max_esi_includes, arg, 0, UINT_MAX); } -static void -tweak_cache_vbe_conns(struct cli *cli, struct parspec *par, const char *arg) -{ - (void)par; - tweak_generic_bool(cli, &master.cache_vbe_conns, arg); -} - /*--------------------------------------------------------------------*/ /* @@ -615,17 +542,17 @@ * Remember to update varnishd.1 whenever you add / remove a parameter or * change its default value. */ -static struct parspec parspec[] = { - { "user", tweak_user, +static const struct parspec parspec[] = { + { "user", tweak_user, NULL, "The unprivileged user to run as. Setting this will " "also set \"group\" to the specified user's primary group.", MUST_RESTART, MAGIC_INIT_STRING }, - { "group", tweak_group, + { "group", tweak_group, NULL, "The unprivileged group to run as.", MUST_RESTART, MAGIC_INIT_STRING }, - { "default_ttl", tweak_default_ttl, + { "default_ttl", tweak_default_ttl, NULL, "The TTL assigned to objects if neither the backend nor " "the VCL code assigns one.\n" "Objects already cached will not be affected by changes " @@ -634,7 +561,7 @@ "flush of the cache use \"url.purge .\"", 0, "120", "seconds" }, - { "thread_pools", tweak_thread_pools, + { "thread_pools", tweak_thread_pools, NULL, "Number of worker pools. " "Increasing number of worker pools decreases lock " "contention but increases the number of threads as well. " @@ -642,27 +569,27 @@ "restart to take effect.", EXPERIMENTAL, "1", "pools" }, - { "thread_pool_max", tweak_thread_pool_max, + { "thread_pool_max", tweak_thread_pool_max, NULL, "The maximum number of threads in the total worker pool.\n" "-1 is unlimited.", EXPERIMENTAL | DELAYED_EFFECT, "1000", "threads" }, - { "thread_pool_min", tweak_thread_pool_min, + { "thread_pool_min", tweak_thread_pool_min, NULL, "The minimum number of threads in the worker pool.\n" "Minimum is 1 thread.", EXPERIMENTAL | DELAYED_EFFECT, "1", "threads" }, - { "thread_pool_timeout", tweak_thread_pool_timeout, + { "thread_pool_timeout", tweak_timeout, &master.wthread_timeout, "Thread dies after this many seconds of inactivity.\n" "Minimum is 1 second.", EXPERIMENTAL | DELAYED_EFFECT, "120", "seconds" }, - { "overflow_max", tweak_overflow_max, + { "overflow_max", tweak_overflow_max, NULL, "Limit on overflow queue length in percent of " "thread_pool_max parameter.", EXPERIMENTAL, "100", "%" }, - { "rush_exponent", tweak_rush_exponent, + { "rush_exponent", tweak_rush_exponent, NULL, "How many parked request we start for each completed " "request on the object.\n" "NB: Even with the implict delay of delivery, " @@ -670,37 +597,37 @@ "number of worker threads. ", EXPERIMENTAL, "3", "requests per request" }, - { "http_workspace", tweak_http_workspace, + { "http_workspace", tweak_http_workspace, NULL, "Bytes of HTTP protocol workspace allocated. " "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" }, - { "sess_timeout", tweak_sess_timeout, + { "sess_timeout", tweak_timeout, &master.sess_timeout, "Idle timeout for persistent sessions. " "If a HTTP request has not been received in this many " "seconds, the session is closed.", 0, "5", "seconds" }, - { "pipe_timeout", tweak_pipe_timeout, + { "pipe_timeout", tweak_timeout, &master.pipe_timeout, "Idle timeout for PIPE sessions. " "If nothing have been received in either direction for " "this many seconds, the session is closed.\n", 0, "60", "seconds" }, - { "send_timeout", tweak_send_timeout, + { "send_timeout", tweak_timeout, &master.send_timeout, "Send timeout for client connections. " "If no data has been sent to the client in this many seconds, " "the session is closed.\n" "See setsockopt(2) under SO_SNDTIMEO for more information.", DELAYED_EFFECT, "600", "seconds" }, - { "auto_restart", tweak_auto_restart, + { "auto_restart", tweak_bool, &master.auto_restart, "Restart child process automatically if it dies.\n", 0, "on", "bool" }, - { "fetch_chunksize", tweak_fetch_chunksize, + { "fetch_chunksize", tweak_fetch_chunksize, NULL, "The default chunksize used by fetcher. " "This should be bigger than the majority of objects with " "short TTLs.\n" @@ -709,12 +636,12 @@ EXPERIMENTAL, "128", "kilobytes" }, #ifdef SENDFILE_WORKS - { "sendfile_threshold", tweak_sendfile_threshold, + { "sendfile_threshold", tweak_sendfile_threshold, NULL, "The minimum size of objects transmitted with sendfile.", EXPERIMENTAL, "-1", "bytes" }, #endif /* SENDFILE_WORKS */ - { "vcl_trace", tweak_vcl_trace, + { "vcl_trace", tweak_bool, &master.vcl_trace, "Trace VCL execution in the shmlog.\n" "Enabling this will allow you to see the path each " "request has taken through the VCL program.\n" @@ -722,50 +649,50 @@ "default.", 0, "off", "bool" }, - { "listen_address", tweak_listen_address, + { "listen_address", tweak_listen_address, NULL, "Whitespace separated list of network endpoints where " "Varnish will accept requests.\n" "Possible formats: host, host:port, :port", MUST_RESTART, ":80" }, - { "listen_depth", tweak_listen_depth, + { "listen_depth", tweak_listen_depth, NULL, "Listen queue depth.", MUST_RESTART, "1024", "connections" }, - { "srcaddr_hash", tweak_srcaddr_hash, + { "srcaddr_hash", tweak_srcaddr_hash, NULL, "Number of source address hash buckets.\n" "Powers of two are bad, prime numbers are good.", EXPERIMENTAL | MUST_RESTART, "1049", "buckets" }, - { "srcaddr_ttl", tweak_srcaddr_ttl, + { "srcaddr_ttl", tweak_srcaddr_ttl, NULL, "Lifetime of srcaddr entries.\n" "Zero will disable srcaddr accounting entirely.", EXPERIMENTAL, "30", "seconds" }, - { "backend_http11", tweak_backend_http11, + { "backend_http11", tweak_bool, &master.backend_http11, "Force all backend requests to be HTTP/1.1.\n" "By default we copy the protocol version from the " "incoming client request.", EXPERIMENTAL, "off", "bool" }, - { "client_http11", tweak_client_http11, + { "client_http11", tweak_bool, &master.client_http11, "Force all client responses to be HTTP/1.1.\n" "By default we copy the protocol version from the " "backend response.", EXPERIMENTAL, "off", "bool" }, - { "cli_timeout", tweak_cli_timeout, + { "cli_timeout", tweak_timeout, &master.cli_timeout, "Timeout for the childs replies to CLI requests from " "the master.", 0, "5", "seconds" }, - { "ping_interval", tweak_ping_interval, + { "ping_interval", tweak_ping_interval, NULL, "Interval between pings from parent to child.\n" "Zero will disable pinging entirely, which makes " "it possible to attach a debugger to the child.", MUST_RESTART, "3", "seconds" }, - { "lru_interval", tweak_lru_timeout, + { "lru_interval", tweak_timeout, &master.lru_timeout, "Grace period before object moves on LRU list.\n" "Objects are only moved to the front of the LRU " "list if they have not been moved there already inside " @@ -773,7 +700,7 @@ "operations necessary for LRU list access.", EXPERIMENTAL, "2", "seconds" }, - { "cc_command", tweak_cc_command, + { "cc_command", tweak_cc_command, NULL, "Command used for compiling the C source code to a " "dlopen(3) loadable object. Any occurrence of %s in " "the string will be replaced with the source file name, " @@ -785,19 +712,19 @@ "exec cc -fpic -shared -Wl,-x -o %o %s" #endif , NULL }, - { "max_restarts", tweak_max_restarts, + { "max_restarts", tweak_max_restarts, NULL, "Upper limit on how many times a request can restart." "\nBe aware that restarts are likely to cause a hit against " "the backend, so don't increase thoughtlessly.\n", 0, "4", "restarts" }, - { "max_esi_includes", tweak_max_esi_includes, + { "max_esi_includes", tweak_max_esi_includes, NULL, "Maximum depth of esi:include processing." "\nBe aware that restarts are likely to cause a hit against " "the backend, so don't increase thoughtlessly.\n", 0, "5", "restarts" }, - { "cache_vbe_conns", tweak_cache_vbe_conns, + { "cache_vbe_conns", tweak_bool, &master.cache_vbe_conns, "Cache vbe_conn's or rely on malloc, that's the question.", EXPERIMENTAL, "off", "bool" }, @@ -835,7 +762,7 @@ void mcf_param_show(struct cli *cli, const char * const *av, void *priv) { - struct parspec *pp; + const struct parspec *pp; int lfmt; (void)priv; @@ -897,7 +824,7 @@ void MCF_ParamSet(struct cli *cli, const char *param, const char *val) { - struct parspec *pp; + const struct parspec *pp; for (pp = parspec; pp->name != NULL; pp++) { if (!strcmp(pp->name, param)) { @@ -932,7 +859,7 @@ void MCF_ParamInit(struct cli *cli) { - struct parspec *pp; + const struct parspec *pp; for (pp = parspec; pp->name != NULL; pp++) { cli_out(cli, "Set Default for %s = %s\n", pp->name, pp->def); From phk at projects.linpro.no Fri Feb 15 10:01:19 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 11:01:19 +0100 (CET) Subject: r2467 - trunk/varnish-cache/bin/varnishd Message-ID: <20080215100119.501571EC454@projects.linpro.no> Author: phk Date: 2008-02-15 11:01:19 +0100 (Fri, 15 Feb 2008) New Revision: 2467 Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c trunk/varnish-cache/bin/varnishd/cache_pool.c Log: remove the undocumented and unimplemented dump.pool command Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-02-15 09:41:23 UTC (rev 2466) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-02-15 10:01:19 UTC (rev 2467) @@ -77,10 +77,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: trunk/varnish-cache/bin/varnishd/cache_pool.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pool.c 2008-02-15 09:41:23 UTC (rev 2466) +++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2008-02-15 10:01:19 UTC (rev 2467) @@ -434,14 +434,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; -} From phk at projects.linpro.no Fri Feb 15 10:02:45 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 11:02:45 +0100 (CET) Subject: r2468 - trunk/varnish-cache/bin/varnishd Message-ID: <20080215100245.E89981EC35F@projects.linpro.no> Author: phk Date: 2008-02-15 11:02:45 +0100 (Fri, 15 Feb 2008) New Revision: 2468 Modified: trunk/varnish-cache/bin/varnishd/cache.h Log: remove dump.pool prototype Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-02-15 10:01:19 UTC (rev 2467) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-02-15 10:02:45 UTC (rev 2468) @@ -569,7 +569,6 @@ cli_func_t cli_func_config_load; cli_func_t cli_func_config_discard; cli_func_t cli_func_config_use; -cli_func_t cli_func_dump_pool; #endif /* cache_vrt_esi.c */ From phk at projects.linpro.no Fri Feb 15 10:08:02 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 11:08:02 +0100 (CET) Subject: r2469 - trunk/varnish-cache/bin/varnishd Message-ID: <20080215100802.A59571EC454@projects.linpro.no> Author: phk Date: 2008-02-15 11:08:02 +0100 (Fri, 15 Feb 2008) New Revision: 2469 Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c trunk/varnish-cache/bin/varnishd/cache_main.c Log: Move the sizeof debugging output to an undocumented debug.sizeof CLI command. Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-02-15 10:02:45 UTC (rev 2468) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-02-15 10:08:02 UTC (rev 2469) @@ -51,6 +51,30 @@ /*--------------------------------------------------------------------*/ 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 cli_func_start(struct cli *cli, const char * const *av, void *priv) { @@ -77,6 +101,10 @@ { CLI_VCL_DISCARD, cli_func_config_discard }, { CLI_VCL_USE, cli_func_config_use }, + /* Undocumented functions for debugging */ + { "debug.sizeof", "debug.sizeof", + "\tDump sizeof various data structures\n", + 0, 0, cli_debug_sizeof }, { NULL } }; Modified: trunk/varnish-cache/bin/varnishd/cache_main.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_main.c 2008-02-15 10:02:45 UTC (rev 2468) +++ trunk/varnish-cache/bin/varnishd/cache_main.c 2008-02-15 10:08:02 UTC (rev 2469) @@ -72,21 +72,6 @@ THR_Name("cache-main"); -#define SZOF(foo) printf("sizeof(%s) = %zd\n", #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); - - CNT_Init(); VCL_Init(); From phk at projects.linpro.no Fri Feb 15 10:28:00 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 11:28:00 +0100 (CET) Subject: r2470 - trunk/varnish-cache/include Message-ID: <20080215102800.E345A1EC35F@projects.linpro.no> Author: phk Date: 2008-02-15 11:28:00 +0100 (Fri, 15 Feb 2008) New Revision: 2470 Modified: trunk/varnish-cache/include/miniobj.h Log: Add ALLOC_OBJ macro Modified: trunk/varnish-cache/include/miniobj.h =================================================================== --- trunk/varnish-cache/include/miniobj.h 2008-02-15 10:08:02 UTC (rev 2469) +++ trunk/varnish-cache/include/miniobj.h 2008-02-15 10:28:00 UTC (rev 2470) @@ -6,6 +6,13 @@ * $Id$ */ +#define ALLOC_OBJ(to, type_magic) \ + do { \ + (to) = calloc(sizeof *(to), 1); \ + if ((to) != NULL) \ + (to)->magic = (type_magic); \ + } while (0) + #define FREE_OBJ(to) \ do { \ (to)->magic = (0); \ From phk at projects.linpro.no Fri Feb 15 10:34:42 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 11:34:42 +0100 (CET) Subject: r2471 - in trunk/varnish-cache: include lib/libvarnish Message-ID: <20080215103442.4BC681EC35F@projects.linpro.no> Author: phk Date: 2008-02-15 11:34:42 +0100 (Fri, 15 Feb 2008) New Revision: 2471 Added: trunk/varnish-cache/include/vlu.h trunk/varnish-cache/lib/libvarnish/vlu.c Modified: trunk/varnish-cache/lib/libvarnish/Makefile.am Log: Add VLU (Varnish Line Up) a copy of LineUp from my private utility library: A set of simple functions for cutting a byte stream into text-lines and calling a function for each of them, as the they become available. Added: trunk/varnish-cache/include/vlu.h =================================================================== --- trunk/varnish-cache/include/vlu.h (rev 0) +++ trunk/varnish-cache/include/vlu.h 2008-02-15 10:34:42 UTC (rev 2471) @@ -0,0 +1,41 @@ +/*- + * Copyright (c) 2005-2008 Poul-Henning Kamp + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: vpf.h 1410 2007-05-11 11:17:09Z des $ + * + * Functions for assembling a bytestream into text-lines and calling + * a function on each. + */ + +#ifndef VLU_H_INCLUDED +#define VLU_H_INCLUDED + +typedef int (vlu_f)(void *, const char *); +struct vlu *VLU_New(void *priv, vlu_f *func); +int VLU_Fd(int fd, struct vlu *l); +int VLU_File(FILE *f, struct vlu *l); +void VLU_Destroy(struct vlu *l); + +#endif Modified: trunk/varnish-cache/lib/libvarnish/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libvarnish/Makefile.am 2008-02-15 10:28:00 UTC (rev 2470) +++ trunk/varnish-cache/lib/libvarnish/Makefile.am 2008-02-15 10:34:42 UTC (rev 2471) @@ -15,6 +15,7 @@ num.c \ time.c \ version.c \ + vlu.c \ vpf.c \ vsb.c \ vss.c \ Added: trunk/varnish-cache/lib/libvarnish/vlu.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/vlu.c (rev 0) +++ trunk/varnish-cache/lib/libvarnish/vlu.c 2008-02-15 10:34:42 UTC (rev 2471) @@ -0,0 +1,129 @@ +/*- + * Copyright (c) 2005-2008 Poul-Henning Kamp + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: vpf.h 1410 2007-05-11 11:17:09Z des $ + * + * Functions for assembling a bytestream into text-lines and calling + * a function on each. + */ + +#include +#include +#include +#include +#include +#include "vlu.h" +#include "miniobj.h" + +struct vlu { + unsigned magic; +#define LINEUP_MAGIC 0x8286661 + char *buf; + unsigned bufl; + unsigned bufp; + void *priv; + vlu_f *func; +}; + +struct vlu * +VLU_New(void *priv, vlu_f *func) +{ + struct vlu *l; + + ALLOC_OBJ(l, LINEUP_MAGIC); + if (l != NULL) { + l->func = func; + l->priv = priv; + l->bufl = BUFSIZ - 1; + l->buf = malloc(l->bufl + 1); + if (l->buf == NULL) { + FREE_OBJ(l); + l = NULL; + } + } + return (l); +} + +void +VLU_Destroy(struct vlu *l) +{ + + CHECK_OBJ_NOTNULL(l, LINEUP_MAGIC); + free(l->buf); + FREE_OBJ(l); +} + +static int +LineUpProcess(struct vlu *l) +{ + char *p, *q; + int i; + + l->buf[l->bufp] = '\0'; + for (p = l->buf; *p != '\0'; p = q) { + q = strchr(p, '\n'); + if (q == NULL) + break; + *q++ = '\0'; + i = l->func(l->priv, p); + if (i != 0) + return (i); + } + if (*p != '\0') { + q = strchr(p, '\0'); + assert(q != NULL); + l->bufp = (unsigned)(q - p); + memmove(l->buf, p, l->bufp); + l->buf[l->bufp] = '\0'; + } else + l->bufp = 0; + return (0); +} + +int +VLU_Fd(int fd, struct vlu *l) +{ + int i; + + CHECK_OBJ_NOTNULL(l, LINEUP_MAGIC); + i = read(fd, l->buf + l->bufp, l->bufl - l->bufp); + if (i <= 0) + return (-1); + l->bufp += i; + return (LineUpProcess(l)); +} + +int +VLU_File(FILE *f, struct vlu *l) +{ + char *p; + + CHECK_OBJ_NOTNULL(l, LINEUP_MAGIC); + p = fgets(l->buf + l->bufp, l->bufl - l->bufp, f); + if (p == NULL) + return (-1); + l->bufp = strlen(l->buf); + return (LineUpProcess(l)); +} From phk at projects.linpro.no Fri Feb 15 10:36:21 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 11:36:21 +0100 (CET) Subject: r2472 - trunk/varnish-cache/bin/varnishd Message-ID: <20080215103621.577A61EC2A4@projects.linpro.no> Author: phk Date: 2008-02-15 11:36:21 +0100 (Fri, 15 Feb 2008) New Revision: 2472 Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c Log: Log everything we see on the childs stdout/stderr to syslog. Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2008-02-15 10:34:42 UTC (rev 2471) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2008-02-15 10:36:21 UTC (rev 2472) @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -54,6 +55,7 @@ #include "cli_priv.h" #include "mgt_cli.h" #include "mgt_event.h" +#include "vlu.h" #include "vss.h" pid_t mgt_pid; @@ -79,28 +81,33 @@ struct evbase *mgt_evb; static struct ev *ev_poker; static struct ev *ev_listen; +static struct vlu *vlu; /*--------------------------------------------------------------------*/ static int +child_line(void *priv, const char *p) +{ + (void)priv; + + fprintf(stderr, "Child said (%d, %d): <<%s>>\n", + child_state, child_pid, p); + syslog(LOG_NOTICE, "Child (%d) said <<%s>>", child_pid, p); + return (0); +} + +/*--------------------------------------------------------------------*/ + +static int child_listener(const struct ev *e, int what) { - int i; - char buf[BUFSIZ]; (void)e; if ((what & ~EV_RD)) { ev_listen = NULL; return (1); } - i = read(child_fds[0], buf, sizeof buf - 1); - if (i <= 0) { - ev_listen = NULL; - return (1); - } - buf[i] = '\0'; - fprintf(stderr, "Child said (%d, %d): <<%s>>\n", - child_state, child_pid, buf); + VLU_Fd(child_fds[0], vlu); return (0); } @@ -222,6 +229,9 @@ AZ(close(child_fds[1])); child_fds[1] = -1; + vlu = VLU_New(NULL, child_line); + AN(vlu); + AZ(ev_listen); e = ev_new(); XXXAN(e); From phk at phk.freebsd.dk Fri Feb 15 10:41:22 2008 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Fri, 15 Feb 2008 10:41:22 +0000 Subject: r2472 - trunk/varnish-cache/bin/varnishd In-Reply-To: Your message of "Fri, 15 Feb 2008 11:36:21 +0100." <20080215103621.577A61EC2A4@projects.linpro.no> Message-ID: <58938.1203072082@critter.freebsd.dk> In message <20080215103621.577A61EC2A4 at projects.linpro.no>, phk at projects.linpro .no writes: >New Revision: 2472 > >Log everything we see on the childs stdout/stderr to syslog. I should have done this a long time ago, but I guess I was too optimistic about the lack of need for it. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From phk at projects.linpro.no Fri Feb 15 10:57:20 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 11:57:20 +0100 (CET) Subject: r2473 - in trunk/varnish-cache: bin/varnishd include lib/libvarnish Message-ID: <20080215105720.5D00E1EC6BC@projects.linpro.no> Author: phk Date: 2008-02-15 11:57:20 +0100 (Fri, 15 Feb 2008) New Revision: 2473 Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/include/vlu.h trunk/varnish-cache/lib/libvarnish/vlu.c Log: A Give VLU_New() an optional buffersize argument Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2008-02-15 10:36:21 UTC (rev 2472) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2008-02-15 10:57:20 UTC (rev 2473) @@ -229,7 +229,7 @@ AZ(close(child_fds[1])); child_fds[1] = -1; - vlu = VLU_New(NULL, child_line); + vlu = VLU_New(NULL, child_line, 0); AN(vlu); AZ(ev_listen); Modified: trunk/varnish-cache/include/vlu.h =================================================================== --- trunk/varnish-cache/include/vlu.h 2008-02-15 10:36:21 UTC (rev 2472) +++ trunk/varnish-cache/include/vlu.h 2008-02-15 10:57:20 UTC (rev 2473) @@ -33,7 +33,7 @@ #define VLU_H_INCLUDED typedef int (vlu_f)(void *, const char *); -struct vlu *VLU_New(void *priv, vlu_f *func); +struct vlu *VLU_New(void *priv, vlu_f *func, unsigned bufsize); int VLU_Fd(int fd, struct vlu *l); int VLU_File(FILE *f, struct vlu *l); void VLU_Destroy(struct vlu *l); Modified: trunk/varnish-cache/lib/libvarnish/vlu.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/vlu.c 2008-02-15 10:36:21 UTC (rev 2472) +++ trunk/varnish-cache/lib/libvarnish/vlu.c 2008-02-15 10:57:20 UTC (rev 2473) @@ -48,15 +48,17 @@ }; struct vlu * -VLU_New(void *priv, vlu_f *func) +VLU_New(void *priv, vlu_f *func, unsigned bufsize) { struct vlu *l; + if (bufsize == 0) + bufsize = BUFSIZ; ALLOC_OBJ(l, LINEUP_MAGIC); if (l != NULL) { l->func = func; l->priv = priv; - l->bufl = BUFSIZ - 1; + l->bufl = bufsize - 1; l->buf = malloc(l->bufl + 1); if (l->buf == NULL) { FREE_OBJ(l); From phk at projects.linpro.no Fri Feb 15 11:15:41 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 12:15:41 +0100 (CET) Subject: r2474 - trunk/varnish-cache/bin/varnishd Message-ID: <20080215111541.92D7B1EC6B3@projects.linpro.no> Author: phk Date: 2008-02-15 12:15:41 +0100 (Fri, 15 Feb 2008) New Revision: 2474 Modified: trunk/varnish-cache/bin/varnishd/cache_main.c Log: Remove a duplicated message on the childs stdout. Modified: trunk/varnish-cache/bin/varnishd/cache_main.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_main.c 2008-02-15 10:57:20 UTC (rev 2473) +++ trunk/varnish-cache/bin/varnishd/cache_main.c 2008-02-15 11:15:41 UTC (rev 2474) @@ -88,7 +88,6 @@ STV_open(); - printf("Ready\n"); VSL_stats->start_time = (time_t)TIM_real(); CLI_Init(); From phk at projects.linpro.no Fri Feb 15 11:15:59 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 12:15:59 +0100 (CET) Subject: r2475 - trunk/varnish-cache/bin/varnishd Message-ID: <20080215111559.A47C21EC484@projects.linpro.no> Author: phk Date: 2008-02-15 12:15:59 +0100 (Fri, 15 Feb 2008) New Revision: 2475 Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c Log: Rewrite the childs CLI handling to use VLU Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-02-15 11:15:41 UTC (rev 2474) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-02-15 11:15:59 UTC (rev 2475) @@ -43,6 +43,7 @@ #include "cli_priv.h" #include "cli_common.h" #include "cache.h" +#include "vlu.h" #include "vsb.h" #include "heritage.h" @@ -108,13 +109,33 @@ { NULL } }; +static int +cli_vlu(void *priv, const char *p) +{ + struct cli *cli; + int i; + + cli = priv; + VSL(SLT_CLI, 0, "Rd %s", p); + vsb_clear(cli->sb); + cli_dispatch(cli, CLI_cmds, p); + vsb_finish(cli->sb); + AZ(vsb_overflowed(cli->sb)); + i = cli_writeres(heritage.fds[1], cli); + if (i) + VSL(SLT_Error, 0, "CLI write failed (errno=%d)", errno); + else + VSL(SLT_CLI, 0, "Wr %d %d %s", + i, cli->result, vsb_data(cli->sb)); + return (0); +} + void CLI_Init(void) { struct pollfd pfd[1]; - char *buf, *p; - unsigned nbuf, lbuf; struct cli *cli, clis; + struct vlu *vlu; int i; cli = &clis; @@ -123,11 +144,9 @@ cli_thread = pthread_self(); cli->sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); XXXAN(cli->sb); - lbuf = 4096; - buf = malloc(lbuf); - XXXAN(buf); - nbuf = 0; - printf("CLI ready\n"); + vlu = VLU_New(cli, cli_vlu, 0); + XXXAN(vlu); + printf("Ready\n"); while (1) { pfd[0].fd = heritage.fds[2]; pfd[0].events = POLLIN; @@ -136,39 +155,18 @@ VCL_Idle(); continue; } - if ((nbuf + 2) >= lbuf) { - lbuf += lbuf; - buf = realloc(buf, lbuf); - XXXAN(buf); + if (pfd[0].revents & POLLHUP) { + fprintf(stderr, + "EOF on CLI connection, exiting\n"); + break; } - i = read(heritage.fds[2], buf + nbuf, lbuf - nbuf); - if (i <= 0) { - VSL(SLT_Error, 0, "CLI read %d (errno=%d)", i, errno); - free(buf); - return; - } - nbuf += i; - p = strchr(buf, '\n'); - if (p == NULL) - continue; - *p = '\0'; - VSL(SLT_CLI, 0, "Rd %s", buf); - vsb_clear(cli->sb); - cli_dispatch(cli, CLI_cmds, buf); - vsb_finish(cli->sb); - AZ(vsb_overflowed(cli->sb)); - i = cli_writeres(heritage.fds[1], cli); + i = VLU_Fd(heritage.fds[2], vlu); if (i) { - VSL(SLT_Error, 0, "CLI write failed (errno=%d)", errno); - free(buf); - return; + fprintf(stderr, + "Error on CLI connection, exiting " + "(VLU_Fd %d ev: %x)\n", + i, pfd[0].revents); + break; } - VSL(SLT_CLI, 0, "Wr %d %d %s", - i, cli->result, vsb_data(cli->sb)); - i = ++p - buf; - assert(i <= nbuf); - if (i < nbuf) - memcpy(buf, p, nbuf - i); - nbuf -= i; } } From phk at projects.linpro.no Fri Feb 15 11:27:26 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 12:27:26 +0100 (CET) Subject: r2476 - trunk/varnish-cache/bin/varnishd Message-ID: <20080215112726.27B631EC6B3@projects.linpro.no> Author: phk Date: 2008-02-15 12:27:25 +0100 (Fri, 15 Feb 2008) New Revision: 2476 Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c Log: Give uint parameters the same treatment as bool and timeouts: eliminate a lot of silly trivial functions. Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-02-15 11:15:59 UTC (rev 2475) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-02-15 11:27:25 UTC (rev 2476) @@ -63,6 +63,8 @@ const char *name; tweak_t *func; volatile void *priv; + unsigned umin; + unsigned umax; const char *descr; int flags; #define DELAYED_EFFECT 1 @@ -174,6 +176,17 @@ } } +/*--------------------------------------------------------------------*/ + +static void +tweak_uint(struct cli *cli, const struct parspec *par, const char *arg) +{ + volatile unsigned *dest; + + dest = par->priv; + tweak_generic_uint(cli, dest, arg, par->umin, par->umax); +} + /*-------------------------------------------------------------------- * XXX: slightly magic. We want to initialize to "nobody" (XXX: shouldn't * XXX: that be something autocrap found for us ?) but we don't want to @@ -257,28 +270,6 @@ /*--------------------------------------------------------------------*/ static void -tweak_default_ttl(struct cli *cli, const struct parspec *par, const char *arg) -{ - - (void)par; - tweak_generic_uint(cli, &master.default_ttl, arg, 0, UINT_MAX); -} - -/*--------------------------------------------------------------------*/ - -static void -tweak_thread_pools(struct cli *cli, const struct parspec *par, const char *arg) -{ - - (void)par; - tweak_generic_uint(cli, &master.wthread_pools, arg, - 1, UINT_MAX); -} - - -/*--------------------------------------------------------------------*/ - -static void tweak_thread_pool_min(struct cli *cli, const struct parspec *par, const char *arg) { @@ -301,63 +292,6 @@ /*--------------------------------------------------------------------*/ static void -tweak_overflow_max(struct cli *cli, const struct parspec *par, const char *arg) -{ - - (void)par; - tweak_generic_uint(cli, &master.overflow_max, arg, 0, UINT_MAX); -} - -/*--------------------------------------------------------------------*/ - -static void -tweak_rush_exponent(struct cli *cli, const struct parspec *par, const char *arg) -{ - - (void)par; - tweak_generic_uint(cli, &master.rush_exponent, arg, - 2, UINT_MAX); -} - -/*--------------------------------------------------------------------*/ - -static void -tweak_http_workspace(struct cli *cli, const struct parspec *par, const char *arg) -{ - - (void)par; - tweak_generic_uint(cli, &master.mem_workspace, arg, - 1024, UINT_MAX); -} - -/*--------------------------------------------------------------------*/ - -static void -tweak_fetch_chunksize(struct cli *cli, const struct parspec *par, const char *arg) -{ - - (void)par; - tweak_generic_uint(cli, &master.fetch_chunksize, arg, - 4, UINT_MAX / 1024); -} - -#ifdef SENDFILE_WORKS -/*--------------------------------------------------------------------*/ - -static void -tweak_sendfile_threshold(struct cli *cli, const struct parspec *par, const char *arg) -{ - - (void)par; - tweak_generic_uint(cli, &master.sendfile_threshold, arg, 0, UINT_MAX); -} -#endif /* SENDFILE_WORKS */ - -/*--------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------*/ - -static void clean_listen_sock_head(struct listen_sock_head *lsh) { struct listen_sock *ls, *ls2; @@ -450,42 +384,6 @@ /*--------------------------------------------------------------------*/ static void -tweak_listen_depth(struct cli *cli, const struct parspec *par, const char *arg) -{ - (void)par; - tweak_generic_uint(cli, &master.listen_depth, arg, 0, UINT_MAX); -} - -/*--------------------------------------------------------------------*/ - -static void -tweak_srcaddr_hash(struct cli *cli, const struct parspec *par, const char *arg) -{ - (void)par; - tweak_generic_uint(cli, &master.srcaddr_hash, arg, 63, UINT_MAX); -} - -/*--------------------------------------------------------------------*/ - -static void -tweak_srcaddr_ttl(struct cli *cli, const struct parspec *par, const char *arg) -{ - (void)par; - tweak_generic_uint(cli, &master.srcaddr_ttl, arg, 0, UINT_MAX); -} - -/*--------------------------------------------------------------------*/ - -static void -tweak_ping_interval(struct cli *cli, const struct parspec *par, const char *arg) -{ - (void)par; - tweak_generic_uint(cli, &master.ping_interval, arg, 0, UINT_MAX); -} - -/*--------------------------------------------------------------------*/ - -static void tweak_cc_command(struct cli *cli, const struct parspec *par, const char *arg) { @@ -500,22 +398,6 @@ } } -static void -tweak_max_restarts(struct cli *cli, const struct parspec *par, const char *arg) -{ - - (void)par; - tweak_generic_uint(cli, &master.max_restarts, arg, 0, UINT_MAX); -} - -static void -tweak_max_esi_includes(struct cli *cli, const struct parspec *par, const char *arg) -{ - - (void)par; - tweak_generic_uint(cli, &master.max_esi_includes, arg, 0, UINT_MAX); -} - /*--------------------------------------------------------------------*/ /* @@ -543,16 +425,16 @@ * change its default value. */ static const struct parspec parspec[] = { - { "user", tweak_user, NULL, + { "user", tweak_user, NULL, 0, 0, "The unprivileged user to run as. Setting this will " "also set \"group\" to the specified user's primary group.", MUST_RESTART, MAGIC_INIT_STRING }, - { "group", tweak_group, NULL, + { "group", tweak_group, NULL, 0, 0, "The unprivileged group to run as.", MUST_RESTART, MAGIC_INIT_STRING }, - { "default_ttl", tweak_default_ttl, NULL, + { "default_ttl", tweak_uint, &master.default_ttl, 0, UINT_MAX, "The TTL assigned to objects if neither the backend nor " "the VCL code assigns one.\n" "Objects already cached will not be affected by changes " @@ -561,7 +443,7 @@ "flush of the cache use \"url.purge .\"", 0, "120", "seconds" }, - { "thread_pools", tweak_thread_pools, NULL, + { "thread_pools", tweak_uint, &master.wthread_pools, 1, UINT_MAX, "Number of worker pools. " "Increasing number of worker pools decreases lock " "contention but increases the number of threads as well. " @@ -569,27 +451,27 @@ "restart to take effect.", EXPERIMENTAL, "1", "pools" }, - { "thread_pool_max", tweak_thread_pool_max, NULL, + { "thread_pool_max", tweak_thread_pool_max, NULL, 0, 0, "The maximum number of threads in the total worker pool.\n" "-1 is unlimited.", EXPERIMENTAL | DELAYED_EFFECT, "1000", "threads" }, - { "thread_pool_min", tweak_thread_pool_min, NULL, + { "thread_pool_min", tweak_thread_pool_min, NULL, 0, 0, "The minimum number of threads in the worker pool.\n" "Minimum is 1 thread.", EXPERIMENTAL | DELAYED_EFFECT, "1", "threads" }, - { "thread_pool_timeout", tweak_timeout, &master.wthread_timeout, + { "thread_pool_timeout", tweak_timeout, &master.wthread_timeout, 0, 0, "Thread dies after this many seconds of inactivity.\n" "Minimum is 1 second.", EXPERIMENTAL | DELAYED_EFFECT, "120", "seconds" }, - { "overflow_max", tweak_overflow_max, NULL, + { "overflow_max", tweak_uint, &master.overflow_max, 0, UINT_MAX, "Limit on overflow queue length in percent of " "thread_pool_max parameter.", EXPERIMENTAL, "100", "%" }, - { "rush_exponent", tweak_rush_exponent, NULL, + { "rush_exponent", tweak_uint, &master.rush_exponent, 2, UINT_MAX, "How many parked request we start for each completed " "request on the object.\n" "NB: Even with the implict delay of delivery, " @@ -597,37 +479,38 @@ "number of worker threads. ", EXPERIMENTAL, "3", "requests per request" }, - { "http_workspace", tweak_http_workspace, NULL, + { "http_workspace", tweak_uint, &master.mem_workspace, 1024, UINT_MAX, "Bytes of HTTP protocol workspace allocated. " "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" }, - { "sess_timeout", tweak_timeout, &master.sess_timeout, + { "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 " "seconds, the session is closed.", 0, "5", "seconds" }, - { "pipe_timeout", tweak_timeout, &master.pipe_timeout, + { "pipe_timeout", tweak_timeout, &master.pipe_timeout, 0, 0, "Idle timeout for PIPE sessions. " "If nothing have been received in either direction for " "this many seconds, the session is closed.\n", 0, "60", "seconds" }, - { "send_timeout", tweak_timeout, &master.send_timeout, + { "send_timeout", tweak_timeout, &master.send_timeout, 0, 0, "Send timeout for client connections. " "If no data has been sent to the client in this many seconds, " "the session is closed.\n" "See setsockopt(2) under SO_SNDTIMEO for more information.", DELAYED_EFFECT, "600", "seconds" }, - { "auto_restart", tweak_bool, &master.auto_restart, + { "auto_restart", tweak_bool, &master.auto_restart, 0, 0, "Restart child process automatically if it dies.\n", 0, "on", "bool" }, - { "fetch_chunksize", tweak_fetch_chunksize, NULL, + { "fetch_chunksize", + tweak_uint, &master.fetch_chunksize, 4, UINT_MAX / 1024, "The default chunksize used by fetcher. " "This should be bigger than the majority of objects with " "short TTLs.\n" @@ -636,12 +519,13 @@ EXPERIMENTAL, "128", "kilobytes" }, #ifdef SENDFILE_WORKS - { "sendfile_threshold", tweak_sendfile_threshold, NULL, + { "sendfile_threshold", + tweak_uint, &master.sendfile_threshold, 0, UINT_MAX, "The minimum size of objects transmitted with sendfile.", EXPERIMENTAL, "-1", "bytes" }, #endif /* SENDFILE_WORKS */ - { "vcl_trace", tweak_bool, &master.vcl_trace, + { "vcl_trace", tweak_bool, &master.vcl_trace, 0, 0, "Trace VCL execution in the shmlog.\n" "Enabling this will allow you to see the path each " "request has taken through the VCL program.\n" @@ -649,50 +533,50 @@ "default.", 0, "off", "bool" }, - { "listen_address", tweak_listen_address, NULL, + { "listen_address", tweak_listen_address, NULL, 0, 0, "Whitespace separated list of network endpoints where " "Varnish will accept requests.\n" "Possible formats: host, host:port, :port", MUST_RESTART, ":80" }, - { "listen_depth", tweak_listen_depth, NULL, + { "listen_depth", tweak_uint, &master.listen_depth, 0, UINT_MAX, "Listen queue depth.", MUST_RESTART, "1024", "connections" }, - { "srcaddr_hash", tweak_srcaddr_hash, NULL, + { "srcaddr_hash", tweak_uint, &master.srcaddr_hash, 63, UINT_MAX, "Number of source address hash buckets.\n" "Powers of two are bad, prime numbers are good.", EXPERIMENTAL | MUST_RESTART, "1049", "buckets" }, - { "srcaddr_ttl", tweak_srcaddr_ttl, NULL, + { "srcaddr_ttl", tweak_uint, &master.srcaddr_ttl, 0, UINT_MAX, "Lifetime of srcaddr entries.\n" "Zero will disable srcaddr accounting entirely.", EXPERIMENTAL, "30", "seconds" }, - { "backend_http11", tweak_bool, &master.backend_http11, + { "backend_http11", tweak_bool, &master.backend_http11, 0, 0, "Force all backend requests to be HTTP/1.1.\n" "By default we copy the protocol version from the " "incoming client request.", EXPERIMENTAL, "off", "bool" }, - { "client_http11", tweak_bool, &master.client_http11, + { "client_http11", tweak_bool, &master.client_http11, 0, 0, "Force all client responses to be HTTP/1.1.\n" "By default we copy the protocol version from the " "backend response.", EXPERIMENTAL, "off", "bool" }, - { "cli_timeout", tweak_timeout, &master.cli_timeout, + { "cli_timeout", tweak_timeout, &master.cli_timeout, 0, 0, "Timeout for the childs replies to CLI requests from " "the master.", 0, "5", "seconds" }, - { "ping_interval", tweak_ping_interval, NULL, + { "ping_interval", tweak_uint, &master.ping_interval, 0, UINT_MAX, "Interval between pings from parent to child.\n" "Zero will disable pinging entirely, which makes " "it possible to attach a debugger to the child.", MUST_RESTART, "3", "seconds" }, - { "lru_interval", tweak_timeout, &master.lru_timeout, + { "lru_interval", tweak_timeout, &master.lru_timeout, 0, 0, "Grace period before object moves on LRU list.\n" "Objects are only moved to the front of the LRU " "list if they have not been moved there already inside " @@ -700,7 +584,7 @@ "operations necessary for LRU list access.", EXPERIMENTAL, "2", "seconds" }, - { "cc_command", tweak_cc_command, NULL, + { "cc_command", tweak_cc_command, NULL, 0, 0, "Command used for compiling the C source code to a " "dlopen(3) loadable object. Any occurrence of %s in " "the string will be replaced with the source file name, " @@ -712,19 +596,20 @@ "exec cc -fpic -shared -Wl,-x -o %o %s" #endif , NULL }, - { "max_restarts", tweak_max_restarts, NULL, + { "max_restarts", tweak_uint, &master.max_restarts, 0, UINT_MAX, "Upper limit on how many times a request can restart." "\nBe aware that restarts are likely to cause a hit against " "the backend, so don't increase thoughtlessly.\n", 0, "4", "restarts" }, - { "max_esi_includes", tweak_max_esi_includes, NULL, + { "max_esi_includes", + tweak_uint, &master.max_esi_includes, 0, UINT_MAX, "Maximum depth of esi:include processing." "\nBe aware that restarts are likely to cause a hit against " "the backend, so don't increase thoughtlessly.\n", 0, "5", "restarts" }, - { "cache_vbe_conns", tweak_bool, &master.cache_vbe_conns, + { "cache_vbe_conns", tweak_bool, &master.cache_vbe_conns, 0, 0, "Cache vbe_conn's or rely on malloc, that's the question.", EXPERIMENTAL, "off", "bool" }, From phk at projects.linpro.no Fri Feb 15 11:52:41 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 12:52:41 +0100 (CET) Subject: r2477 - trunk/varnish-cache/bin/varnishd Message-ID: <20080215115241.B9EDE1EC484@projects.linpro.no> Author: phk Date: 2008-02-15 12:52:41 +0100 (Fri, 15 Feb 2008) New Revision: 2477 Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c trunk/varnish-cache/bin/varnishd/heritage.h trunk/varnish-cache/bin/varnishd/mgt.h trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/bin/varnishd/mgt_param.c Log: Add a paramter for maximum CLI buffer size and use it both in child and manager. To take effect, it must be specified with -p on the command line. Use VLU for managers CLI handling. Note CLI connection events on stderr. Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-02-15 11:27:25 UTC (rev 2476) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-02-15 11:52:41 UTC (rev 2477) @@ -144,7 +144,7 @@ cli_thread = pthread_self(); cli->sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); XXXAN(cli->sb); - vlu = VLU_New(cli, cli_vlu, 0); + vlu = VLU_New(cli, cli_vlu, params->cli_buffer); XXXAN(vlu); printf("Ready\n"); while (1) { Modified: trunk/varnish-cache/bin/varnishd/heritage.h =================================================================== --- trunk/varnish-cache/bin/varnishd/heritage.h 2008-02-15 11:27:25 UTC (rev 2476) +++ trunk/varnish-cache/bin/varnishd/heritage.h 2008-02-15 11:52:41 UTC (rev 2477) @@ -138,6 +138,9 @@ /* Cache vbe_conns */ unsigned cache_vbe_conns; + + /* CLI buffer size */ + unsigned cli_buffer; }; extern volatile struct params *params; Modified: trunk/varnish-cache/bin/varnishd/mgt.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt.h 2008-02-15 11:27:25 UTC (rev 2476) +++ trunk/varnish-cache/bin/varnishd/mgt.h 2008-02-15 11:52:41 UTC (rev 2477) @@ -45,7 +45,7 @@ /* mgt_cli.c */ void mgt_cli_init(void); -void mgt_cli_setup(int fdi, int fdo, int verbose); +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); void mgt_cli_stop_child(void); Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2008-02-15 11:27:25 UTC (rev 2476) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2008-02-15 11:52:41 UTC (rev 2477) @@ -392,7 +392,7 @@ XXXAN(mgt_evb); if (dflag) - mgt_cli_setup(0, 1, 1); + mgt_cli_setup(0, 1, 1, "debug"); if (T_arg) mgt_cli_telnet(T_arg); Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2008-02-15 11:27:25 UTC (rev 2476) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2008-02-15 11:52:41 UTC (rev 2477) @@ -57,6 +57,7 @@ #include "mgt_event.h" #include "shmlog.h" +#include "vlu.h" #include "vss.h" static int cli_i = -1, cli_o = -1; @@ -288,19 +289,20 @@ int fdi; int fdo; int verbose; - char *buf; - int nbuf; /* next free position in buf */ - int lbuf; /* length of buf */ + struct vlu *vlu; struct cli cli[1]; - char name[30]; + char *name; }; static int mgt_cli_close(const struct cli_port *cp) { + CHECK_OBJ_NOTNULL(cp, CLI_PORT_MAGIC); + fprintf(stderr, "CLI closing: %s\n", cp->name); vsb_delete(cp->cli->sb); - free(cp->buf); + VLU_Destroy(cp->vlu); + free(cp->name); (void)close(cp->fdi); if (cp->fdi == 0) assert(open("/dev/null", O_RDONLY) == 0); @@ -314,10 +316,26 @@ } static int +mgt_cli_vlu(void *priv, const char *p) +{ + struct cli_port *cp; + + 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)); + + /* send the result back */ + if (cli_writeres(cp->fdo, cp->cli)) + return (mgt_cli_close(cp)); + return (0); +} + +static int mgt_cli_callback(const struct ev *e, int what) { struct cli_port *cp; - char *p, *q; int i; CAST_OBJ_NOTNULL(cp, e->priv, CLI_PORT_MAGIC); @@ -325,66 +343,32 @@ if (what & (EV_ERR | EV_HUP | EV_GONE)) return (mgt_cli_close(cp)); - /* grow the buffer if it is full */ - if (cp->nbuf == cp->lbuf) { - cp->lbuf += cp->lbuf; - cp->buf = realloc(cp->buf, cp->lbuf); - XXXAN(cp->buf); + i = VLU_Fd(cp->fdi, cp->vlu); + if (i != 0) { + mgt_cli_close(cp); + return (1); } - - /* read more data into the buffer */ - i = read(cp->fdi, cp->buf + cp->nbuf, cp->lbuf - cp->nbuf); - if (i <= 0) - return (mgt_cli_close(cp)); - cp->nbuf += i; - - for (p = q = cp->buf; q < cp->buf + cp->nbuf; ++q) { - if (*q != '\n') - continue; - /* got a newline == got a command */ - *q = '\0'; - vsb_clear(cp->cli->sb); - cli_dispatch(cp->cli, cli_proto, p); - vsb_finish(cp->cli->sb); - AZ(vsb_overflowed(cp->cli->sb)); - - /* send the result back */ - if (cli_writeres(cp->fdo, cp->cli)) - return (mgt_cli_close(cp)); - - /* ready for next command */ - p = q + 1; - } - - /* see if there's any data left in the buffer */ - if (p != q) { - assert(q == cp->buf + cp->nbuf); - cp->nbuf -= (p - cp->buf); - memmove(cp->buf, p, cp->nbuf); - } else - cp->nbuf = 0; return (0); } void -mgt_cli_setup(int fdi, int fdo, int verbose) +mgt_cli_setup(int fdi, int fdo, int verbose, const char *ident) { struct cli_port *cp; cp = calloc(sizeof *cp, 1); XXXAN(cp); + cp->vlu = VLU_New(cp, mgt_cli_vlu, params->cli_buffer); - sprintf(cp->name, "cli %d->%d", fdi, fdo); + asprintf(&cp->name, "cli %s fds{%d,%d}", ident, fdi, fdo); + XXXAN(cp->name); + fprintf(stderr, "CLI opened: %s\n", cp->name); cp->magic = CLI_PORT_MAGIC; cp->fdi = fdi; cp->fdo = fdo; cp->verbose = verbose; - cp->lbuf = 4096; - cp->buf = malloc(cp->lbuf); - XXXAN(cp->buf); - cp->cli->sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); XXXAN(cp->cli->sb); @@ -403,6 +387,9 @@ struct sockaddr_storage addr; socklen_t addrlen; int i; + char abuf1[TCP_ADDRBUFSIZE], abuf2[TCP_ADDRBUFSIZE]; + char pbuf1[TCP_PORTBUFSIZE], pbuf2[TCP_PORTBUFSIZE]; + char *p; (void)what; addrlen = sizeof addr; @@ -410,7 +397,14 @@ if (i < 0) return (0); - mgt_cli_setup(i, i, 0); + TCP_myname(ev->fd, abuf1, sizeof abuf1, pbuf1, sizeof pbuf1); + TCP_name((void*)&addr, addrlen, abuf2, sizeof abuf2, + pbuf2, sizeof pbuf2); + asprintf(&p, "telnet{%s:%s,%s:%s}", abuf2, pbuf2, abuf1, pbuf1); + XXXAN(p); + + mgt_cli_setup(i, i, 0, p); + free(p); return (0); } Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-02-15 11:27:25 UTC (rev 2476) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-02-15 11:52:41 UTC (rev 2477) @@ -613,6 +613,13 @@ "Cache vbe_conn's or rely on malloc, that's the question.", EXPERIMENTAL, "off", "bool" }, + { "cli_buffer", tweak_uint, &master.cli_buffer, 4096, UINT_MAX, + "Size of buffer for CLI input." + "\nYou may need to increase this if you have big VCL files " + "and use the vcl.inline CLI command.\n" + "NB: Must be specified with -p to have effect.\n", + 0, + "8192", "bytes" }, { NULL, NULL, NULL } }; From phk at projects.linpro.no Fri Feb 15 12:30:47 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 13:30:47 +0100 (CET) Subject: r2478 - in trunk/varnish-cache: . bin/varnishd include Message-ID: <20080215123047.7E9A51EC6B1@projects.linpro.no> Author: phk Date: 2008-02-15 13:30:47 +0100 (Fri, 15 Feb 2008) New Revision: 2478 Modified: trunk/varnish-cache/bin/varnishd/cache_panic.c trunk/varnish-cache/configure.ac trunk/varnish-cache/include/cli_common.h Log: Use the abort2(2) function to record our panic string, if we have it. Protect macros with do {....} while(0) Modified: trunk/varnish-cache/bin/varnishd/cache_panic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_panic.c 2008-02-15 11:52:41 UTC (rev 2477) +++ trunk/varnish-cache/bin/varnishd/cache_panic.c 2008-02-15 12:30:47 UTC (rev 2478) @@ -34,6 +34,7 @@ #include #include #include +#include #include "cache.h" @@ -48,15 +49,20 @@ char panicstr[65536]; static char *pstr = panicstr; -#define fp(...) \ - pstr += snprintf(pstr, \ - (panicstr + sizeof panicstr) - pstr, \ - __VA_ARGS__) -#define vfp(fmt, ap) \ - pstr += vsnprintf(pstr, \ - (panicstr + sizeof panicstr) - pstr, \ - (fmt), (ap)) +#define fp(...) \ + do { \ + pstr += snprintf(pstr, \ + (panicstr + sizeof panicstr) - pstr, \ + __VA_ARGS__); \ + } while (0) +#define vfp(fmt, ap) \ + do { \ + pstr += vsnprintf(pstr, \ + (panicstr + sizeof panicstr) - pstr, \ + (fmt), (ap)); \ + } while (0) + /* step names */ static const char *steps[] = { #define STEP(l, u) "STP_" #u, @@ -195,11 +201,23 @@ if (VALID_OBJ(sp, SESS_MAGIC)) dump_sess(sp); - fputs(panicstr, stderr); + (void)fputs(panicstr, stderr); /* I wish there was a way to flush the log buffers... */ - signal(SIGABRT, SIG_DFL); - raise(SIGABRT); + (void)signal(SIGABRT, SIG_DFL); +#ifdef HAVE_ABORT2 + { + void *arg[1]; + char *p; + + for (p = panicstr; *p; p++) + if (*p == '\n') + *p = ' '; + arg[0] = panicstr; + abort2(panicstr, 1, arg); + } +#endif + (void)raise(SIGABRT); } #endif Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2008-02-15 11:52:41 UTC (rev 2477) +++ trunk/varnish-cache/configure.ac 2008-02-15 12:30:47 UTC (rev 2478) @@ -100,6 +100,7 @@ AC_CHECK_FUNCS([strptime]) AC_CHECK_FUNCS([fmtcheck]) AC_CHECK_FUNCS([getdtablesize]) +AC_CHECK_FUNCS([abort2]) save_LIBS="${LIBS}" LIBS="${PTHREAD_LIBS}" Modified: trunk/varnish-cache/include/cli_common.h =================================================================== --- trunk/varnish-cache/include/cli_common.h 2008-02-15 11:52:41 UTC (rev 2477) +++ trunk/varnish-cache/include/cli_common.h 2008-02-15 12:30:47 UTC (rev 2478) @@ -30,6 +30,7 @@ */ struct cli { + /* XXX: should be MINI_OBJ */ struct vsb *sb; enum cli_status_e result; }; From phk at projects.linpro.no Fri Feb 15 12:42:48 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 13:42:48 +0100 (CET) Subject: r2479 - trunk/varnish-cache/lib/libvcl Message-ID: <20080215124248.E59811EC484@projects.linpro.no> Author: phk Date: 2008-02-15 13:42:48 +0100 (Fri, 15 Feb 2008) New Revision: 2479 Modified: trunk/varnish-cache/lib/libvcl/vcc_acl.c trunk/varnish-cache/lib/libvcl/vcc_action.c trunk/varnish-cache/lib/libvcl/vcc_parse.c Log: Don't advance the token in vcc_UintVal(), that prevents precise error messages based on the value of the integer. Modified: trunk/varnish-cache/lib/libvcl/vcc_acl.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_acl.c 2008-02-15 12:30:47 UTC (rev 2478) +++ trunk/varnish-cache/lib/libvcl/vcc_acl.c 2008-02-15 12:42:48 UTC (rev 2479) @@ -75,6 +75,7 @@ vcc_NextToken(tl); ExpectErr(tl, CNUM); mask = vcc_UintVal(tl); + vcc_NextToken(tl); } Fh(tl, 1, "{ %u, %u, %u, ", not, mask, para); EncToken(tl->fh, t); Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_action.c 2008-02-15 12:30:47 UTC (rev 2478) +++ trunk/varnish-cache/lib/libvcl/vcc_action.c 2008-02-15 12:42:48 UTC (rev 2479) @@ -97,9 +97,10 @@ unsigned a; vcc_NextToken(tl); - if (tl->t->tok == CNUM) + if (tl->t->tok == CNUM) { a = vcc_UintVal(tl); - else + vcc_NextToken(tl); + } else a = 0; Fb(tl, 1, "VRT_error(sp, %u", a); if (tl->t->tok == CSTR) { @@ -182,9 +183,10 @@ vcc_RateVal(tl); else if (vp->fmt == FLOAT) Fb(tl, 0, "%g", vcc_DoubleVal(tl)); - else if (vp->fmt == INT) + else if (vp->fmt == INT) { Fb(tl, 0, "%u", vcc_UintVal(tl)); - else { + vcc_NextToken(tl); + } else { vsb_printf(tl->sb, "Cannot assign this variable type.\n"); vcc_ErrWhere(tl, vt); return; Modified: trunk/varnish-cache/lib/libvcl/vcc_parse.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_parse.c 2008-02-15 12:30:47 UTC (rev 2478) +++ trunk/varnish-cache/lib/libvcl/vcc_parse.c 2008-02-15 12:42:48 UTC (rev 2479) @@ -150,7 +150,6 @@ d *= 10; d += *p - '0'; } - vcc_NextToken(tl); return (d); } From phk at projects.linpro.no Fri Feb 15 12:44:42 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 13:44:42 +0100 (CET) Subject: r2480 - trunk/varnish-cache/lib/libvcl Message-ID: <20080215124442.35DC41EC484@projects.linpro.no> Author: phk Date: 2008-02-15 13:44:42 +0100 (Fri, 15 Feb 2008) New Revision: 2480 Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c Log: Insist on a non-zero weight for random director memebers and Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-02-15 12:42:48 UTC (rev 2479) +++ trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-02-15 12:44:42 UTC (rev 2480) @@ -385,12 +385,13 @@ struct token *t_field; int nbh, nelem; struct fld_spec *fs; + unsigned u; Fh(tl, 1, "\n#define VGC_backend_%.*s (VCL_conf.director[%d])\n", PF(t_dir), tl->nbackend); vcc_AddDef(tl, t_dir, R_BACKEND); - fs = vcc_FldSpec(tl, "!backend", "?weight", NULL); + fs = vcc_FldSpec(tl, "!backend", "!weight", NULL); vcc_NextToken(tl); /* ID: policy (= random) */ @@ -418,7 +419,16 @@ ERRCHK(tl); } else if (vcc_IdIs(t_field, "weight")) { ExpectErr(tl, CNUM); - Fc(tl, 0, " .weight = %.*s,", PF(tl->t)); + u = vcc_UintVal(tl); + if (u == 0) { + vsb_printf(tl->sb, + "The .weight must be higher than zero."); + vcc_ErrToken(tl, tl->t); + vsb_printf(tl->sb, " at\n"); + vcc_ErrWhere(tl, tl->t); + return; + } + Fc(tl, 0, " .weight = %u", u); vcc_NextToken(tl); ExpectErr(tl, ';'); vcc_NextToken(tl); From phk at projects.linpro.no Fri Feb 15 12:47:43 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 13:47:43 +0100 (CET) Subject: r2481 - trunk/varnish-cache/bin/varnishd Message-ID: <20080215124743.6A9271EC384@projects.linpro.no> Author: phk Date: 2008-02-15 13:47:42 +0100 (Fri, 15 Feb 2008) New Revision: 2481 Modified: trunk/varnish-cache/bin/varnishd/cache_dir_random.c Log: Assert that VCC did its job with respect to weights. Modified: trunk/varnish-cache/bin/varnishd/cache_dir_random.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_dir_random.c 2008-02-15 12:44:42 UTC (rev 2480) +++ trunk/varnish-cache/bin/varnishd/cache_dir_random.c 2008-02-15 12:47:42 UTC (rev 2481) @@ -56,7 +56,6 @@ #define VDI_RANDOM_MAGIC 0x476d25b7 struct director dir; struct backend *backend; - unsigned nhosts; struct vdi_random_host *hosts; }; @@ -121,6 +120,7 @@ vh = vs->hosts; te = t->members; for (i = 0; i < t->nmember; i++, vh++, te++) { + assert(te->weight > 0.0); s += te->weight; vh->backend = VBE_AddBackend(cli, te->host); } @@ -128,6 +128,7 @@ /* Normalize weights */ i = 0; a = 0.0; + assert(s > 0.0); for (te = t->members; te->host != NULL; te++, i++) { /* First normalize the specified weight in FP */ b = te->weight / s; From phk at projects.linpro.no Fri Feb 15 12:56:02 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 13:56:02 +0100 (CET) Subject: r2482 - trunk/varnish-cache/bin/varnishd Message-ID: <20080215125602.1EFAB1EC6B1@projects.linpro.no> Author: phk Date: 2008-02-15 13:56:01 +0100 (Fri, 15 Feb 2008) New Revision: 2482 Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c Log: Remove a spurious debugging message. Account for the HTTP bits we do know about and handle. Ignore return value from shutdown(2) Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pipe.c 2008-02-15 12:47:42 UTC (rev 2481) +++ trunk/varnish-cache/bin/varnishd/cache_pipe.c 2008-02-15 12:56:01 UTC (rev 2482) @@ -57,10 +57,8 @@ j = write(fd1, p, i); if (j <= 0) return (1); - if (i != j) { - printf("flunk %d %d\n", i, j); - usleep(100000); /* XXX hack */ - } + if (i != j) + (void)usleep(100000); /* XXX hack */ } return (0); } @@ -85,10 +83,11 @@ return; WRK_Reset(w, &vc->fd); - http_Write(w, bereq->http, 0); + w->acct.hdrbytes += http_Write(w, bereq->http, 0); if (sp->htc->pipeline.b != NULL) - WRK_Write(w, sp->htc->pipeline.b, Tlen(sp->htc->pipeline)); + w->acct.bodybytes += + WRK_Write(w, sp->htc->pipeline.b, Tlen(sp->htc->pipeline)); if (WRK_Flush(w)) { vca_close_session(sp, "pipe"); @@ -114,25 +113,25 @@ if (i < 1) break; if (fds[0].revents && rdf(vc->fd, sp->fd)) { - shutdown(vc->fd, SHUT_RD); - shutdown(sp->fd, SHUT_WR); + (void)shutdown(vc->fd, SHUT_RD); + (void)shutdown(sp->fd, SHUT_WR); fds[0].events = 0; fds[0].fd = -1; } if (fds[1].revents && rdf(sp->fd, vc->fd)) { - shutdown(sp->fd, SHUT_RD); - shutdown(vc->fd, SHUT_WR); + (void)shutdown(sp->fd, SHUT_RD); + (void)shutdown(vc->fd, SHUT_WR); fds[1].events = 0; fds[1].fd = -1; } } if (fds[0].fd >= 0) { - shutdown(vc->fd, SHUT_RD); - shutdown(sp->fd, SHUT_WR); + (void)shutdown(vc->fd, SHUT_RD); + (void)shutdown(sp->fd, SHUT_WR); } if (fds[1].fd >= 0) { - shutdown(sp->fd, SHUT_RD); - shutdown(vc->fd, SHUT_WR); + (void)shutdown(sp->fd, SHUT_RD); + (void)shutdown(vc->fd, SHUT_WR); } vca_close_session(sp, "pipe"); VBE_ClosedFd(sp->wrk, vc); From phk at projects.linpro.no Fri Feb 15 12:59:59 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 13:59:59 +0100 (CET) Subject: r2483 - trunk/varnish-cache/bin/varnishd Message-ID: <20080215125959.D11DA1EC484@projects.linpro.no> Author: phk Date: 2008-02-15 13:59:59 +0100 (Fri, 15 Feb 2008) New Revision: 2483 Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c Log: Check VLU_Fd return for good measure. Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2008-02-15 12:56:01 UTC (rev 2482) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2008-02-15 12:59:59 UTC (rev 2483) @@ -107,7 +107,10 @@ ev_listen = NULL; return (1); } - VLU_Fd(child_fds[0], vlu); + if (VLU_Fd(child_fds[0], vlu)) { + ev_listen = NULL; + return (1); + } return (0); } From phk at projects.linpro.no Fri Feb 15 13:04:36 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 14:04:36 +0100 (CET) Subject: r2484 - trunk/varnish-cache/bin/varnishd Message-ID: <20080215130436.E138E1EC384@projects.linpro.no> Author: phk Date: 2008-02-15 14:04:36 +0100 (Fri, 15 Feb 2008) New Revision: 2484 Modified: trunk/varnish-cache/bin/varnishd/cache_dir_random.c Log: Flexelint does not react to the assert, so tell it what we know. Modified: trunk/varnish-cache/bin/varnishd/cache_dir_random.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_dir_random.c 2008-02-15 12:59:59 UTC (rev 2483) +++ trunk/varnish-cache/bin/varnishd/cache_dir_random.c 2008-02-15 13:04:36 UTC (rev 2484) @@ -131,7 +131,7 @@ assert(s > 0.0); for (te = t->members; te->host != NULL; te++, i++) { /* First normalize the specified weight in FP */ - b = te->weight / s; + b = te->weight / s; /*lint !e795 not zero division */ /* Then accumulate to eliminate rounding errors */ a += b; /* Convert to unsigned in random() range */ From phk at projects.linpro.no Fri Feb 15 13:19:49 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 14:19:49 +0100 (CET) Subject: r2485 - trunk/varnish-cache/bin/varnishd Message-ID: <20080215131949.DF84C1EC484@projects.linpro.no> Author: phk Date: 2008-02-15 14:19:49 +0100 (Fri, 15 Feb 2008) New Revision: 2485 Modified: trunk/varnish-cache/bin/varnishd/varnishd.c Log: Tell if we could not write the PID file. Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2008-02-15 13:04:36 UTC (rev 2484) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2008-02-15 13:19:49 UTC (rev 2485) @@ -553,8 +553,8 @@ if (d_flag == 1) printf("%d\n", getpid()); - if (pfh != NULL) - vpf_write(pfh); /* XXX: Warn or Err if fail ? */ + if (pfh != NULL && vpf_write(pfh) + fprintf(stderr, "NOTE: Could not write PID file\n"); mgt_cli_init(); From phk at projects.linpro.no Fri Feb 15 13:31:47 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 14:31:47 +0100 (CET) Subject: r2486 - trunk/varnish-cache/bin/varnishd Message-ID: <20080215133147.7DD091EC384@projects.linpro.no> Author: phk Date: 2008-02-15 14:31:47 +0100 (Fri, 15 Feb 2008) New Revision: 2486 Modified: trunk/varnish-cache/bin/varnishd/varnishd.c Log: Somebody ate my ')' on the way to the commit. Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2008-02-15 13:19:49 UTC (rev 2485) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2008-02-15 13:31:47 UTC (rev 2486) @@ -553,7 +553,7 @@ if (d_flag == 1) printf("%d\n", getpid()); - if (pfh != NULL && vpf_write(pfh) + if (pfh != NULL && vpf_write(pfh)) fprintf(stderr, "NOTE: Could not write PID file\n"); mgt_cli_init(); From phk at projects.linpro.no Fri Feb 15 13:32:04 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 14:32:04 +0100 (CET) Subject: r2487 - trunk/varnish-cache/bin/varnishd Message-ID: <20080215133204.CA4591EC6B1@projects.linpro.no> Author: phk Date: 2008-02-15 14:32:04 +0100 (Fri, 15 Feb 2008) New Revision: 2487 Modified: trunk/varnish-cache/bin/varnishd/flint.sh Log: Define VARNISH_STATE_DIR Modified: trunk/varnish-cache/bin/varnishd/flint.sh =================================================================== --- trunk/varnish-cache/bin/varnishd/flint.sh 2008-02-15 13:31:47 UTC (rev 2486) +++ trunk/varnish-cache/bin/varnishd/flint.sh 2008-02-15 13:32:04 UTC (rev 2487) @@ -6,6 +6,7 @@ -I. \ -I../../include \ -I../.. \ + -DVARNISH_STATE_DIR=\"foo\" \ flint.lnt \ *.c > $T 2>&1 From phk at projects.linpro.no Fri Feb 15 13:32:41 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 14:32:41 +0100 (CET) Subject: r2488 - trunk/varnish-cache/bin/varnishd Message-ID: <20080215133241.CBC8B1EC384@projects.linpro.no> Author: phk Date: 2008-02-15 14:32:41 +0100 (Fri, 15 Feb 2008) New Revision: 2488 Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c Log: Unused variable Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_expire.c 2008-02-15 13:32:04 UTC (rev 2487) +++ trunk/varnish-cache/bin/varnishd/cache_expire.c 2008-02-15 13:32:41 UTC (rev 2488) @@ -70,9 +70,7 @@ static void update_object_when(struct object *o) { - double w; - w = o->ttl; if (o->prefetch < 0.0) { o->timer_when = o->ttl + o->prefetch; o->timer_what = TIMER_PREFETCH; From phk at projects.linpro.no Fri Feb 15 13:35:22 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 14:35:22 +0100 (CET) Subject: r2489 - trunk/varnish-cache/bin/varnishd Message-ID: <20080215133522.6416E1EC6B1@projects.linpro.no> Author: phk Date: 2008-02-15 14:35:22 +0100 (Fri, 15 Feb 2008) New Revision: 2489 Modified: trunk/varnish-cache/bin/varnishd/storage_file.c Log: Make this cast less suspect to Flexelint Modified: trunk/varnish-cache/bin/varnishd/storage_file.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_file.c 2008-02-15 13:32:41 UTC (rev 2488) +++ trunk/varnish-cache/bin/varnishd/storage_file.c 2008-02-15 13:35:22 UTC (rev 2489) @@ -609,7 +609,7 @@ (uintmax_t)sum, sc->filesize); /* XXX */ - if (sum < MINPAGES * (uintmax_t)getpagesize()) + if (sum < MINPAGES * (off_t)getpagesize()) exit (2); MTX_INIT(&sc->mtx); From phk at projects.linpro.no Fri Feb 15 14:22:23 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 15 Feb 2008 15:22:23 +0100 (CET) Subject: r2490 - trunk/varnish-cache/bin/varnishd Message-ID: <20080215142223.B4D0D1EC484@projects.linpro.no> Author: phk Date: 2008-02-15 15:22:23 +0100 (Fri, 15 Feb 2008) New Revision: 2490 Modified: trunk/varnish-cache/bin/varnishd/cache_dir_random.c trunk/varnish-cache/bin/varnishd/flint.lnt Log: Flexelint pleasing Modified: trunk/varnish-cache/bin/varnishd/cache_dir_random.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_dir_random.c 2008-02-15 13:35:22 UTC (rev 2489) +++ trunk/varnish-cache/bin/varnishd/cache_dir_random.c 2008-02-15 14:22:23 UTC (rev 2490) @@ -75,7 +75,7 @@ for (vh = vs->hosts; ; vh++) if (r < vh->weight) return (vh->backend); - assert(0 != __LINE__); + assert(0 == __LINE__); return (NULL); } Modified: trunk/varnish-cache/bin/varnishd/flint.lnt =================================================================== --- trunk/varnish-cache/bin/varnishd/flint.lnt 2008-02-15 13:35:22 UTC (rev 2489) +++ trunk/varnish-cache/bin/varnishd/flint.lnt 2008-02-15 14:22:23 UTC (rev 2490) @@ -1,4 +1,4 @@ --passes=8 +-passes=3 +libh mgt_event.h +libh ../../config.h @@ -53,6 +53,8 @@ -emacro(506, isnan) // constant value boolean -emacro(747, isnan) // significant coersion -emacro(506, assert) // constant value boolean +-emacro(827, assert) // loop not reachable +-emacro(774, assert) // booelan always true -emacro(774, HTTPH) // always false // cache.h From des at projects.linpro.no Sat Feb 16 11:03:37 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sat, 16 Feb 2008 12:03:37 +0100 (CET) Subject: r2491 - trunk/varnish-cache/bin/varnishd Message-ID: <20080216110337.9B5B21EC513@projects.linpro.no> Author: des Date: 2008-02-16 12:03:37 +0100 (Sat, 16 Feb 2008) New Revision: 2491 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c Log: We may get spurious events on an unclosed fd as well. It won't cause any harm, but I still want to catch it early so we get a log entry for it. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2008-02-15 14:22:23 UTC (rev 2490) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2008-02-16 11:03:37 UTC (rev 2491) @@ -221,9 +221,9 @@ #endif spassert(sp->id == kp->ident); spassert(sp->fd == sp->id || sp->fd == -1); - if (sp->fd == -1) { - VSL(SLT_Debug, sp->id, "%s(): got event 0x%04x on closed fd", - __func__, kp->fflags); + if (sp->fd == -1 || kp->fflags == 0) { + VSL(SLT_Debug, sp->id, "%s(): got event 0x%04x on fd %d", + __func__, kp->fflags, sp->fd); return; } if (kp->data > 0) { From des at projects.linpro.no Sun Feb 17 08:53:01 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 17 Feb 2008 09:53:01 +0100 (CET) Subject: r2492 - trunk/varnish-cache/bin/varnishreplay Message-ID: <20080217085301.9C73F1EC384@projects.linpro.no> Author: des Date: 2008-02-17 09:53:01 +0100 (Sun, 17 Feb 2008) New Revision: 2492 Modified: trunk/varnish-cache/bin/varnishreplay/varnishreplay.c Log: Request is bogus if df_m, df_Uq or df_H are NULL (Coverity CID#2, CID#3) Modified: trunk/varnish-cache/bin/varnishreplay/varnishreplay.c =================================================================== --- trunk/varnish-cache/bin/varnishreplay/varnishreplay.c 2008-02-16 11:03:37 UTC (rev 2491) +++ trunk/varnish-cache/bin/varnishreplay/varnishreplay.c 2008-02-17 08:53:01 UTC (rev 2492) @@ -521,6 +521,9 @@ if (tag != SLT_ReqEnd) continue; + if (!df_m || !df_Uq || !df_H) + bogus = 1; + if (bogus) { thread_log(1, "bogus\n"); } else { From des at projects.linpro.no Sun Feb 17 08:54:53 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 17 Feb 2008 09:54:53 +0100 (CET) Subject: r2493 - trunk/varnish-cache/bin/varnishreplay Message-ID: <20080217085453.E98FD1EC384@projects.linpro.no> Author: des Date: 2008-02-17 09:54:53 +0100 (Sun, 17 Feb 2008) New Revision: 2493 Modified: trunk/varnish-cache/bin/varnishreplay/varnishreplay.c Log: Make sure buf is freed in error case (Coverity CID#9) Modified: trunk/varnish-cache/bin/varnishreplay/varnishreplay.c =================================================================== --- trunk/varnish-cache/bin/varnishreplay/varnishreplay.c 2008-02-17 08:53:01 UTC (rev 2492) +++ trunk/varnish-cache/bin/varnishreplay/varnishreplay.c 2008-02-17 08:54:53 UTC (rev 2493) @@ -363,7 +363,8 @@ (2048 < length - nbuf ? 2048 : length - nbuf)); if (n <= 0) { thread_log(0, "failed reading the block\n"); - return (-1); + nbuf = -1; + break; } nbuf += n; } From des at projects.linpro.no Sun Feb 17 09:03:32 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 17 Feb 2008 10:03:32 +0100 (CET) Subject: r2494 - trunk/varnish-cache/bin/varnishreplay Message-ID: <20080217090332.3C1C81EC21C@projects.linpro.no> Author: des Date: 2008-02-17 10:03:32 +0100 (Sun, 17 Feb 2008) New Revision: 2494 Modified: trunk/varnish-cache/bin/varnishreplay/varnishreplay.c Log: Free leftover buffers when the loop ends (Coverity CID#10) Modified: trunk/varnish-cache/bin/varnishreplay/varnishreplay.c =================================================================== --- trunk/varnish-cache/bin/varnishreplay/varnishreplay.c 2008-02-17 08:54:53 UTC (rev 2493) +++ trunk/varnish-cache/bin/varnishreplay/varnishreplay.c 2008-02-17 09:03:32 UTC (rev 2494) @@ -585,6 +585,16 @@ freez(df_c); bogus = 0; } + + /* leftovers */ + freez(msg->ptr); + freez(msg); + freez(df_H); + freez(df_Host); + freez(df_Uq); + freez(df_m); + freez(df_c); + return (0); } From des at projects.linpro.no Sun Feb 17 09:22:06 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 17 Feb 2008 10:22:06 +0100 (CET) Subject: r2495 - in branches/1.1: . bin/varnishadm bin/varnishd bin/varnishhist bin/varnishlog bin/varnishncsa bin/varnishreplay bin/varnishstat bin/varnishtop include include/compat lib/libvarnish lib/libvarnishapi lib/libvarnishcompat lib/libvcl man Message-ID: <20080217092206.490351EC384@projects.linpro.no> Author: des Date: 2008-02-17 10:22:05 +0100 (Sun, 17 Feb 2008) New Revision: 2495 Modified: branches/1.1/ branches/1.1/LICENSE branches/1.1/bin/varnishadm/varnishadm.1 branches/1.1/bin/varnishadm/varnishadm.c branches/1.1/bin/varnishd/cache.h branches/1.1/bin/varnishd/cache_acceptor.c branches/1.1/bin/varnishd/cache_acceptor.h 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/common.h branches/1.1/bin/varnishd/hash_classic.c branches/1.1/bin/varnishd/hash_simple_list.c branches/1.1/bin/varnishd/hash_slinger.h branches/1.1/bin/varnishd/heritage.h branches/1.1/bin/varnishd/mgt.h branches/1.1/bin/varnishd/mgt_child.c branches/1.1/bin/varnishd/mgt_cli.c branches/1.1/bin/varnishd/mgt_cli.h branches/1.1/bin/varnishd/mgt_event.c branches/1.1/bin/varnishd/mgt_event.h 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/steps.h branches/1.1/bin/varnishd/stevedore.c branches/1.1/bin/varnishd/stevedore.h 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/varnishhist.1 branches/1.1/bin/varnishhist/varnishhist.c branches/1.1/bin/varnishlog/varnishlog.1 branches/1.1/bin/varnishlog/varnishlog.c branches/1.1/bin/varnishncsa/varnishncsa.1 branches/1.1/bin/varnishncsa/varnishncsa.c branches/1.1/bin/varnishreplay/varnishreplay.1 branches/1.1/bin/varnishreplay/varnishreplay.c branches/1.1/bin/varnishstat/varnishstat.1 branches/1.1/bin/varnishstat/varnishstat.c branches/1.1/bin/varnishtop/varnishtop.1 branches/1.1/bin/varnishtop/varnishtop.c branches/1.1/configure.ac branches/1.1/include/binary_heap.h branches/1.1/include/cli.h branches/1.1/include/cli_common.h branches/1.1/include/cli_priv.h branches/1.1/include/compat/asprintf.h branches/1.1/include/compat/daemon.h branches/1.1/include/compat/setproctitle.h branches/1.1/include/compat/srandomdev.h branches/1.1/include/compat/strlcat.h branches/1.1/include/compat/strlcpy.h branches/1.1/include/compat/strndup.h branches/1.1/include/compat/vasprintf.h branches/1.1/include/http_headers.h branches/1.1/include/libvarnish.h branches/1.1/include/libvcl.h branches/1.1/include/shmlog.h branches/1.1/include/shmlog_tags.h branches/1.1/include/stat_field.h branches/1.1/include/stats.h branches/1.1/include/varnishapi.h branches/1.1/include/vrt.h branches/1.1/include/vss.h 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/vss.c branches/1.1/lib/libvarnishapi/instance.c branches/1.1/lib/libvarnishapi/shmlog.c branches/1.1/lib/libvarnishcompat/asprintf.c branches/1.1/lib/libvarnishcompat/setproctitle.c branches/1.1/lib/libvarnishcompat/srandomdev.c branches/1.1/lib/libvarnishcompat/strndup.c branches/1.1/lib/libvarnishcompat/vasprintf.c 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_compile.h 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_parse.c branches/1.1/lib/libvcl/vcc_priv.h 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 branches/1.1/man/vcl.7 Log: Merged revisions 2233-2242,2244-2245,2256-2262,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317,2319,2321,2323,2325-2327,2358,2362-2364,2366,2374,2376-2378,2380-2381,2384-2386,2414-2415,2426,2432-2434,2444-2445,2457,2492-2494 via svnmerge from svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache ........ r2414 | des | 2008-01-31 12:41:32 +0100 (Thu, 31 Jan 2008) | 3 lines Mention that varnishd(1) has a list of commands and parameters, and also how to obtain them from varnishd itself. ........ r2415 | des | 2008-01-31 12:57:51 +0100 (Thu, 31 Jan 2008) | 2 lines Update copyright; also convert a couple of files from ISO-8859-1 to UTF-8. ........ r2444 | des | 2008-02-10 19:00:33 +0100 (Sun, 10 Feb 2008) | 2 lines Alphabetize command-line options. ........ r2445 | des | 2008-02-11 03:58:41 +0100 (Mon, 11 Feb 2008) | 8 lines Separate the handling of backend and client requests, greatly simplifying both. Skip piped requests, and requests that are interrupted by an error. This should eliminate or at least greatly reduce the (null)s seen in logs. Fix a conditional that blocked backend requests from being printed. ........ r2457 | des | 2008-02-13 18:10:04 +0100 (Wed, 13 Feb 2008) | 2 lines SLT_Length is not relevant for backend requests. ........ r2492 | des | 2008-02-17 09:53:01 +0100 (Sun, 17 Feb 2008) | 2 lines Request is bogus if df_m, df_Uq or df_H are NULL (Coverity CID#2, CID#3) ........ r2493 | des | 2008-02-17 09:54:53 +0100 (Sun, 17 Feb 2008) | 2 lines Make sure buf is freed in error case (Coverity CID#9) ........ r2494 | des | 2008-02-17 10:03:32 +0100 (Sun, 17 Feb 2008) | 2 lines Free leftover buffers when the loop ends (Coverity CID#10) ........ 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,2306,2310,2313-2314,2316,2318,2320,2322,2324,2357,2359,2361,2375,2379,2383 + /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,2426,2432-2434,2444-2445,2457,2492-2494 Modified: branches/1.1/LICENSE =================================================================== --- branches/1.1/LICENSE 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/LICENSE 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,5 +1,5 @@ Copyright (c) 2006 Verdens Gang AS -Copyright (c) 2006-2007 Linpro AS +Copyright (c) 2006-2008 Linpro AS All rights reserved. Redistribution and use in source and binary forms, with or without Modified: branches/1.1/bin/varnishadm/varnishadm.1 =================================================================== --- branches/1.1/bin/varnishadm/varnishadm.1 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishadm/varnishadm.1 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ .\"- .\" Copyright (c) 2006 Verdens Gang AS -.\" Copyright (c) 2006-2007 Linpro AS +.\" Copyright (c) 2006-2008 Linpro AS .\" All rights reserved. .\" .\" Author: Cecilie Fritzvold @@ -28,7 +28,7 @@ .\" .\" $Id$ .\" -.Dd September 12, 2007 +.Dd January 31, 2008 .Dt VARNISHADM 1 .Os .Sh NAME @@ -50,6 +50,15 @@ .It Fl T Ar address Ns : Ns Ar port Connect to the management interface at the specified address and port. .El +.Pp +Available commands and parameters are documented in the +.Xr varnishd 1 +manual page. +Additionally, a summary of commands can be obtained by issuing the +.Cm help +command, and a summary of parameters can be obtained by issuing the +.Cm param.show +command. .Sh EXIT STATUS The exit status of the .Nm Modified: branches/1.1/bin/varnishadm/varnishadm.c =================================================================== --- branches/1.1/bin/varnishadm/varnishadm.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishadm/varnishadm.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Cecilie Fritzvold Modified: branches/1.1/bin/varnishd/cache.h =================================================================== --- branches/1.1/bin/varnishd/cache.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_acceptor.c =================================================================== --- branches/1.1/bin/varnishd/cache_acceptor.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_acceptor.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_acceptor.h =================================================================== --- branches/1.1/bin/varnishd/cache_acceptor.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_acceptor.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_acceptor_epoll.c =================================================================== --- branches/1.1/bin/varnishd/cache_acceptor_epoll.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_acceptor_epoll.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: branches/1.1/bin/varnishd/cache_acceptor_kqueue.c =================================================================== --- branches/1.1/bin/varnishd/cache_acceptor_kqueue.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_acceptor_kqueue.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_acceptor_poll.c =================================================================== --- branches/1.1/bin/varnishd/cache_acceptor_poll.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_acceptor_poll.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_backend.c =================================================================== --- branches/1.1/bin/varnishd/cache_backend.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_backend.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_ban.c =================================================================== --- branches/1.1/bin/varnishd/cache_ban.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_ban.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_center.c =================================================================== --- branches/1.1/bin/varnishd/cache_center.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_center.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_cli.c =================================================================== --- branches/1.1/bin/varnishd/cache_cli.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_cli.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_expire.c =================================================================== --- branches/1.1/bin/varnishd/cache_expire.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_expire.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_fetch.c =================================================================== --- branches/1.1/bin/varnishd/cache_fetch.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_fetch.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_hash.c =================================================================== --- branches/1.1/bin/varnishd/cache_hash.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_hash.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_http.c =================================================================== --- branches/1.1/bin/varnishd/cache_http.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_http.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_main.c =================================================================== --- branches/1.1/bin/varnishd/cache_main.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_main.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_pipe.c =================================================================== --- branches/1.1/bin/varnishd/cache_pipe.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_pipe.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_pool.c =================================================================== --- branches/1.1/bin/varnishd/cache_pool.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_pool.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_response.c =================================================================== --- branches/1.1/bin/varnishd/cache_response.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_response.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_session.c =================================================================== --- branches/1.1/bin/varnishd/cache_session.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_session.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_synthetic.c =================================================================== --- branches/1.1/bin/varnishd/cache_synthetic.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_synthetic.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007 Linpro AS + * Copyright (c) 2007-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.1/bin/varnishd/cache_vary.c =================================================================== --- branches/1.1/bin/varnishd/cache_vary.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_vary.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_vcl.c =================================================================== --- branches/1.1/bin/varnishd/cache_vcl.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_vcl.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_vrt.c =================================================================== --- branches/1.1/bin/varnishd/cache_vrt.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_vrt.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_vrt_acl.c =================================================================== --- branches/1.1/bin/varnishd/cache_vrt_acl.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_vrt_acl.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_vrt_re.c =================================================================== --- branches/1.1/bin/varnishd/cache_vrt_re.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_vrt_re.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/cache_ws.c =================================================================== --- branches/1.1/bin/varnishd/cache_ws.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/cache_ws.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/common.h =================================================================== --- branches/1.1/bin/varnishd/common.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/common.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/hash_classic.c =================================================================== --- branches/1.1/bin/varnishd/hash_classic.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/hash_classic.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/hash_simple_list.c =================================================================== --- branches/1.1/bin/varnishd/hash_simple_list.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/hash_simple_list.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/hash_slinger.h =================================================================== --- branches/1.1/bin/varnishd/hash_slinger.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/hash_slinger.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/heritage.h =================================================================== --- branches/1.1/bin/varnishd/heritage.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/heritage.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/mgt.h =================================================================== --- branches/1.1/bin/varnishd/mgt.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/mgt.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/mgt_child.c =================================================================== --- branches/1.1/bin/varnishd/mgt_child.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/mgt_child.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/mgt_cli.c =================================================================== --- branches/1.1/bin/varnishd/mgt_cli.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/mgt_cli.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/mgt_cli.h =================================================================== --- branches/1.1/bin/varnishd/mgt_cli.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/mgt_cli.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/mgt_event.c =================================================================== --- branches/1.1/bin/varnishd/mgt_event.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/mgt_event.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/mgt_event.h =================================================================== --- branches/1.1/bin/varnishd/mgt_event.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/mgt_event.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/mgt_param.c =================================================================== --- branches/1.1/bin/varnishd/mgt_param.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/mgt_param.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/mgt_vcc.c =================================================================== --- branches/1.1/bin/varnishd/mgt_vcc.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/mgt_vcc.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/rfc2616.c =================================================================== --- branches/1.1/bin/varnishd/rfc2616.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/rfc2616.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/shmlog.c =================================================================== --- branches/1.1/bin/varnishd/shmlog.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/shmlog.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/steps.h =================================================================== --- branches/1.1/bin/varnishd/steps.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/steps.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/stevedore.c =================================================================== --- branches/1.1/bin/varnishd/stevedore.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/stevedore.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007 Linpro AS + * Copyright (c) 2007-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm?rgav Modified: branches/1.1/bin/varnishd/stevedore.h =================================================================== --- branches/1.1/bin/varnishd/stevedore.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/stevedore.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/storage_file.c =================================================================== --- branches/1.1/bin/varnishd/storage_file.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/storage_file.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/storage_malloc.c =================================================================== --- branches/1.1/bin/varnishd/storage_malloc.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/storage_malloc.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/tcp.c =================================================================== --- branches/1.1/bin/varnishd/tcp.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/tcp.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishd/varnishd.1 =================================================================== --- branches/1.1/bin/varnishd/varnishd.1 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/varnishd.1 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ .\"- .\" Copyright (c) 2006 Verdens Gang AS -.\" Copyright (c) 2006-2007 Linpro AS +.\" Copyright (c) 2006-2008 Linpro AS .\" All rights reserved. .\" .\" Author: Dag-Erling Sm??rgrav Modified: branches/1.1/bin/varnishd/varnishd.c =================================================================== --- branches/1.1/bin/varnishd/varnishd.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishd/varnishd.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishhist/varnishhist.1 =================================================================== --- branches/1.1/bin/varnishhist/varnishhist.1 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishhist/varnishhist.1 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ .\"- .\" Copyright (c) 2006 Verdens Gang AS -.\" Copyright (c) 2006-2007 Linpro AS +.\" Copyright (c) 2006-2008 Linpro AS .\" All rights reserved. .\" .\" Author: Dag-Erling Sm??rgrav Modified: branches/1.1/bin/varnishhist/varnishhist.c =================================================================== --- branches/1.1/bin/varnishhist/varnishhist.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishhist/varnishhist.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishlog/varnishlog.1 =================================================================== --- branches/1.1/bin/varnishlog/varnishlog.1 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishlog/varnishlog.1 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ .\"- .\" Copyright (c) 2006 Verdens Gang AS -.\" Copyright (c) 2006-2007 Linpro AS +.\" Copyright (c) 2006-2008 Linpro AS .\" All rights reserved. .\" .\" Author: Dag-Erling Sm??rgrav Modified: branches/1.1/bin/varnishlog/varnishlog.c =================================================================== --- branches/1.1/bin/varnishlog/varnishlog.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishlog/varnishlog.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp @@ -296,6 +296,14 @@ case 'a': a_flag = 1; break; + case 'b': + b_flag = 1; + VSL_Arg(vd, c, optarg); + break; + case 'c': + c_flag = 1; + VSL_Arg(vd, c, optarg); + break; case 'D': D_flag = 1; break; @@ -314,16 +322,6 @@ case 'w': w_arg = optarg; break; - case 'c': - c_flag = 1; - if (VSL_Arg(vd, c, optarg) > 0) - break; - usage(); - case 'b': - b_flag = 1; - if (VSL_Arg(vd, c, optarg) > 0) - break; - usage(); default: if (VSL_Arg(vd, c, optarg) > 0) break; Modified: branches/1.1/bin/varnishncsa/varnishncsa.1 =================================================================== --- branches/1.1/bin/varnishncsa/varnishncsa.1 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishncsa/varnishncsa.1 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ .\"- .\" Copyright (c) 2006 Verdens Gang AS -.\" Copyright (c) 2006-2007 Linpro AS +.\" Copyright (c) 2006-2008 Linpro AS .\" All rights reserved. .\" .\" Author: Dag-Erling Sm??rgrav Modified: branches/1.1/bin/varnishncsa/varnishncsa.c =================================================================== --- branches/1.1/bin/varnishncsa/varnishncsa.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishncsa/varnishncsa.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Anders Berg @@ -92,14 +92,13 @@ char *df_h; /* %h (host name / IP adress)*/ char *df_m; /* %m, Request method*/ char *df_s; /* %s, Status */ + struct tm df_t; /* %t, Date and time */ char *df_u; /* %u, Remote user */ int bogus; /* bogus request */ } **ll; static size_t nll; -static time_t t; - static int isprefix(const char *str, const char *prefix, const char *end, const char **next) { @@ -175,53 +174,98 @@ } static int -h_ncsa(void *priv, enum shmlogtag tag, unsigned fd, - unsigned len, unsigned spec, const char *ptr) +collect_backend(struct logline *lp, enum shmlogtag tag, unsigned spec, + const char *ptr, unsigned len) { const char *end, *next; - char *q; - FILE *fo; - long l; - struct tm tm; - char tbuf[40]; - struct logline *lp; + assert(spec & VSL_S_BACKEND); end = ptr + len; - if (!(spec & VSL_S_CLIENT || spec & VSL_S_BACKEND)) - return (reopen); - - if (fd >= nll) { - struct logline **newll = ll; - size_t newnll = nll; - - while (fd >= newnll) - newnll += newnll + 1; - newll = realloc(newll, newnll * sizeof *newll); - assert(newll != NULL); - memset(newll + nll, 0, (newnll - nll) * sizeof *newll); - ll = newll; - nll = newnll; - } - if (ll[fd] == NULL) { - ll[fd] = calloc(sizeof *ll[fd], 1); - assert(ll[fd] != NULL); - } - lp = ll[fd]; - switch (tag) { case SLT_BackendOpen: - if (!(spec & VSL_S_BACKEND)) - break; if (lp->df_h != NULL) lp->bogus = 1; - else { + else if (isprefix(ptr, "default", end, &next)) lp->df_h = trimfield(next, end); else lp->df_h = trimfield(ptr, end); - } break; + + case SLT_TxRequest: + if (lp->df_m != NULL) + lp->bogus = 1; + else + lp->df_m = trimline(ptr, end); + break; + + case SLT_TxURL: + if (lp->df_Uq != NULL) + lp->bogus = 1; + else + lp->df_Uq = trimline(ptr, end); + break; + + case SLT_TxProtocol: + if (lp->df_H != NULL) + lp->bogus = 1; + else + lp->df_H = trimline(ptr, end); + break; + + case SLT_RxStatus: + if (lp->df_s != NULL) + lp->bogus = 1; + else + lp->df_s = trimline(ptr, end); + break; + + case SLT_RxHeader: + if (isprefix(ptr, "content-length:", end, &next)) + lp->df_b = trimline(next, end); + else if (isprefix(ptr, "date:", end, &next) && + strptime(next, "%a, %d %b %Y %T", &lp->df_t) == NULL) + lp->bogus = 1; + break; + + case SLT_TxHeader: + if (isprefix(ptr, "user-agent:", end, &next)) + lp->df_User_agent = trimline(next, end); + else if (isprefix(ptr, "referer:", end, &next)) + lp->df_Referer = trimline(next, end); + else if (isprefix(ptr, "authorization:", end, &next) && + isprefix(next, "basic", end, &next)) + lp->df_u = trimline(next, end); + else if (isprefix(ptr, "host:", end, &next)) + lp->df_Host = trimline(next, end); + break; + + case SLT_BackendReuse: + case SLT_BackendClose: + /* got it all */ + return (0); + + default: + break; + } + + /* more to come */ + return (1); +} + +static int +collect_client(struct logline *lp, enum shmlogtag tag, unsigned spec, + const char *ptr, unsigned len) +{ + const char *end, *next; + long l; + time_t t; + + assert(spec & VSL_S_CLIENT); + end = ptr + len; + + switch (tag) { case SLT_ReqStart: if (lp->df_h != NULL) lp->bogus = 1; @@ -229,71 +273,35 @@ lp->df_h = trimfield(ptr, end); break; - case SLT_TxRequest: - if (!(spec & VSL_S_BACKEND)) - break; case SLT_RxRequest: - if (tag == SLT_RxRequest && (spec & VSL_S_BACKEND)) - break; - if (lp->df_m != NULL) lp->bogus = 1; else lp->df_m = trimline(ptr, end); break; - case SLT_TxURL: - if (!(spec & VSL_S_BACKEND)) - break; case SLT_RxURL: - if (tag == SLT_RxURL && (spec & VSL_S_BACKEND)) - break; - if (lp->df_Uq != NULL) lp->bogus = 1; else lp->df_Uq = trimline(ptr, end); break; - case SLT_TxProtocol: - if (!(spec & VSL_S_BACKEND)) - break; case SLT_RxProtocol: - if (tag == SLT_RxProtocol && (spec & VSL_S_BACKEND)) - break; - if (lp->df_H != NULL) lp->bogus = 1; else lp->df_H = trimline(ptr, end); break; - case SLT_RxStatus: - if (!(spec & VSL_S_BACKEND)) - break; case SLT_TxStatus: - if (tag == SLT_TxStatus && (spec & VSL_S_BACKEND)) - break; - if (lp->df_s != NULL) lp->bogus = 1; else lp->df_s = trimline(ptr, end); break; - case SLT_TxHeader: - if (!(spec & VSL_S_BACKEND)) - break; case SLT_RxHeader: - if (tag == SLT_RxHeader && (spec & VSL_S_BACKEND)) { - if (isprefix(ptr, "content-length:", end, &next)) { - lp->df_b = trimline(next, end); - } else if (isprefix(ptr, "date:", end, &next)) { - if (strptime(trimline(next, end), "%a, %d %b %Y %T", &tm)) - t = mktime(&tm); - } - break; - } if (isprefix(ptr, "user-agent:", end, &next)) lp->df_User_agent = trimline(next, end); else if (isprefix(ptr, "referer:", end, &next)) @@ -312,24 +320,73 @@ lp->df_b = trimline(ptr, end); break; + case SLT_SessionClose: + if (strncmp(ptr, "pipe", len) == 0 || + strncmp(ptr, "error", len) == 0) + lp->bogus = 1; + break; + + case SLT_ReqEnd: + if (sscanf(ptr, "%*u %*u.%*u %ld.", &l) != 1) { + lp->bogus = 1; + } else { + t = l; + localtime_r(&t, &lp->df_t); + } + /* got it all */ + return (0); + default: break; } - if ((spec & VSL_S_CLIENT) && tag != SLT_ReqEnd) - return (reopen); + /* more to come */ + return (1); +} - if ((spec & VSL_S_BACKEND) && tag != SLT_BackendReuse && - (tag != SLT_BackendClose || lp->df_Uq)) - return (reopen); +static int +h_ncsa(void *priv, enum shmlogtag tag, unsigned fd, + unsigned len, unsigned spec, const char *ptr) +{ + struct logline *lp; + FILE *fo = priv; + char *q, tbuf[64]; - if (tag == SLT_ReqEnd) { - if (sscanf(ptr, "%*u %*u.%*u %ld.", &l) != 1) - lp->bogus = 1; - else - t = l; + if (fd >= nll) { + struct logline **newll = ll; + size_t newnll = nll; + + while (fd >= newnll) + newnll += newnll + 1; + newll = realloc(newll, newnll * sizeof *newll); + assert(newll != NULL); + memset(newll + nll, 0, (newnll - nll) * sizeof *newll); + ll = newll; + nll = newnll; } + if (ll[fd] == NULL) { + ll[fd] = calloc(sizeof *ll[fd], 1); + assert(ll[fd] != NULL); + } + lp = ll[fd]; + if (spec & VSL_S_BACKEND) { + if (collect_backend(lp, tag, spec, ptr, len)) + return (reopen); + } else if (spec & VSL_S_CLIENT) { + if (collect_client(lp, tag, spec, ptr, len)) + return (reopen); + } else { + /* huh? */ + return (reopen); + } + +#if 0 + /* non-optional fields */ + if (!lp->df_m || !lp->df_Uq || !lp->df_H || !lp->df_s) + lp->bogus = 1; +#endif + if (!lp->bogus) { fo = priv; @@ -362,8 +419,7 @@ } /* %t */ - localtime_r(&t, &tm); - strftime(tbuf, sizeof tbuf, "[%d/%b/%Y:%T %z]", &tm); + strftime(tbuf, sizeof tbuf, "[%d/%b/%Y:%T %z]", &lp->df_t); fprintf(fo, "%s ", tbuf); /* @@ -383,7 +439,7 @@ fprintf(fo, "%s ", lp->df_s); /* %b */ - fprintf(fo, "%s ", lp->df_b); + fprintf(fo, "%s ", lp->df_b ? lp->df_b : "-"); /* %{Referer}i */ fprintf(fo, "\"%s\" ", @@ -411,7 +467,7 @@ freez(lp->df_s); freez(lp->df_u); #undef freez - lp->bogus = 0; + memset(lp, 0, sizeof *lp); return (reopen); } Modified: branches/1.1/bin/varnishreplay/varnishreplay.1 =================================================================== --- branches/1.1/bin/varnishreplay/varnishreplay.1 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishreplay/varnishreplay.1 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,5 +1,5 @@ .\"- -.\" Copyright (c) 2007 Linpro AS +.\" Copyright (c) 2007-2008 Linpro AS .\" All rights reserved. .\" .\" Author: Cecilie Fritzvold Modified: branches/1.1/bin/varnishreplay/varnishreplay.c =================================================================== --- branches/1.1/bin/varnishreplay/varnishreplay.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishreplay/varnishreplay.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -360,7 +360,8 @@ (2048 < length - nbuf ? 2048 : length - nbuf)); if (n <= 0) { thread_log(0, "failed reading the block\n"); - return (-1); + nbuf = -1; + break; } nbuf += n; } @@ -518,6 +519,9 @@ if (tag != SLT_ReqEnd) continue; + if (!df_m || !df_Uq || !df_H) + bogus = 1; + if (bogus) { thread_log(1, "bogus\n"); } else { @@ -578,6 +582,16 @@ freez(df_c); bogus = 0; } + + /* leftovers */ + freez(msg->ptr); + freez(msg); + freez(df_H); + freez(df_Host); + freez(df_Uq); + freez(df_m); + freez(df_c); + return (0); } Modified: branches/1.1/bin/varnishstat/varnishstat.1 =================================================================== --- branches/1.1/bin/varnishstat/varnishstat.1 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishstat/varnishstat.1 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ .\"- .\" Copyright (c) 2006 Verdens Gang AS -.\" Copyright (c) 2006-2007 Linpro AS +.\" Copyright (c) 2006-2008 Linpro AS .\" All rights reserved. .\" .\" Author: Dag-Erling Sm??rgrav Modified: branches/1.1/bin/varnishstat/varnishstat.c =================================================================== --- branches/1.1/bin/varnishstat/varnishstat.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishstat/varnishstat.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/bin/varnishtop/varnishtop.1 =================================================================== --- branches/1.1/bin/varnishtop/varnishtop.1 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishtop/varnishtop.1 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ .\"- .\" Copyright (c) 2006 Verdens Gang AS -.\" Copyright (c) 2006-2007 Linpro AS +.\" Copyright (c) 2006-2008 Linpro AS .\" All rights reserved. .\" .\" Author: Dag-Erling Sm??rgrav Modified: branches/1.1/bin/varnishtop/varnishtop.c =================================================================== --- branches/1.1/bin/varnishtop/varnishtop.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/bin/varnishtop/varnishtop.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/configure.ac =================================================================== --- branches/1.1/configure.ac 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/configure.ac 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,7 +1,7 @@ # $Id$ AC_PREREQ(2.59) -AC_COPYRIGHT([Copyright (c) 2006-2007 Linpro AS / Verdens Gang AS]) +AC_COPYRIGHT([Copyright (c) 2006-2008 Linpro AS / Verdens Gang AS]) AC_REVISION([$Id$]) AC_INIT([Varnish], [1.1.2], [varnish-dev at projects.linpro.no]) AC_CONFIG_SRCDIR(include/varnishapi.h) Modified: branches/1.1/include/binary_heap.h =================================================================== --- branches/1.1/include/binary_heap.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/include/binary_heap.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/include/cli.h =================================================================== --- branches/1.1/include/cli.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/include/cli.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/include/cli_common.h =================================================================== --- branches/1.1/include/cli_common.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/include/cli_common.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/include/cli_priv.h =================================================================== --- branches/1.1/include/cli_priv.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/include/cli_priv.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/include/compat/asprintf.h =================================================================== --- branches/1.1/include/compat/asprintf.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/include/compat/asprintf.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.1/include/compat/daemon.h =================================================================== --- branches/1.1/include/compat/daemon.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/include/compat/daemon.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.1/include/compat/setproctitle.h =================================================================== --- branches/1.1/include/compat/setproctitle.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/include/compat/setproctitle.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.1/include/compat/srandomdev.h =================================================================== --- branches/1.1/include/compat/srandomdev.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/include/compat/srandomdev.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.1/include/compat/strlcat.h =================================================================== --- branches/1.1/include/compat/strlcat.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/include/compat/strlcat.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.1/include/compat/strlcpy.h =================================================================== --- branches/1.1/include/compat/strlcpy.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/include/compat/strlcpy.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.1/include/compat/strndup.h =================================================================== --- branches/1.1/include/compat/strndup.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/include/compat/strndup.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.1/include/compat/vasprintf.h =================================================================== --- branches/1.1/include/compat/vasprintf.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/include/compat/vasprintf.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.1/include/http_headers.h =================================================================== --- branches/1.1/include/http_headers.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/include/http_headers.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/include/libvarnish.h =================================================================== --- branches/1.1/include/libvarnish.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/include/libvarnish.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/include/libvcl.h =================================================================== --- branches/1.1/include/libvcl.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/include/libvcl.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/include/shmlog.h =================================================================== --- branches/1.1/include/shmlog.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/include/shmlog.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/include/shmlog_tags.h =================================================================== --- branches/1.1/include/shmlog_tags.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/include/shmlog_tags.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/include/stat_field.h =================================================================== --- branches/1.1/include/stat_field.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/include/stat_field.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/include/stats.h =================================================================== --- branches/1.1/include/stats.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/include/stats.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/include/varnishapi.h =================================================================== --- branches/1.1/include/varnishapi.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/include/varnishapi.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/include/vrt.h =================================================================== --- branches/1.1/include/vrt.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/include/vrt.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/include/vss.h =================================================================== --- branches/1.1/include/vss.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/include/vss.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: branches/1.1/lib/libvarnish/argv.c =================================================================== --- branches/1.1/lib/libvarnish/argv.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvarnish/argv.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/lib/libvarnish/assert.c =================================================================== --- branches/1.1/lib/libvarnish/assert.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvarnish/assert.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/lib/libvarnish/binary_heap.c =================================================================== --- branches/1.1/lib/libvarnish/binary_heap.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvarnish/binary_heap.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/lib/libvarnish/cli.c =================================================================== --- branches/1.1/lib/libvarnish/cli.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvarnish/cli.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/lib/libvarnish/cli_common.c =================================================================== --- branches/1.1/lib/libvarnish/cli_common.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvarnish/cli_common.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/lib/libvarnish/crc32.c =================================================================== --- branches/1.1/lib/libvarnish/crc32.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvarnish/crc32.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/lib/libvarnish/flopen.c =================================================================== --- branches/1.1/lib/libvarnish/flopen.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvarnish/flopen.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007 Dag-Erling Co?dan Sm?rgrav + * Copyright (c) 2007 Dag-Erling Co??dan Sm??rgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: branches/1.1/lib/libvarnish/time.c =================================================================== --- branches/1.1/lib/libvarnish/time.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvarnish/time.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/lib/libvarnish/version.c =================================================================== --- branches/1.1/lib/libvarnish/version.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvarnish/version.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav @@ -40,5 +40,5 @@ { fprintf(stderr, "%s (%s-%s)\n", progname, PACKAGE_TARNAME, PACKAGE_VERSION); - fprintf(stderr, "Copyright (c) 2006-2007 Linpro AS / Verdens Gang AS\n"); + fprintf(stderr, "Copyright (c) 2006-2008 Linpro AS / Verdens Gang AS\n"); } Modified: branches/1.1/lib/libvarnish/vss.c =================================================================== --- branches/1.1/lib/libvarnish/vss.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvarnish/vss.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.1/lib/libvarnishapi/instance.c =================================================================== --- branches/1.1/lib/libvarnishapi/instance.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvarnishapi/instance.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007 Linpro AS + * Copyright (c) 2007-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.1/lib/libvarnishapi/shmlog.c =================================================================== --- branches/1.1/lib/libvarnishapi/shmlog.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvarnishapi/shmlog.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/lib/libvarnishcompat/asprintf.c =================================================================== --- branches/1.1/lib/libvarnishcompat/asprintf.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvarnishcompat/asprintf.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.1/lib/libvarnishcompat/setproctitle.c =================================================================== --- branches/1.1/lib/libvarnishcompat/setproctitle.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvarnishcompat/setproctitle.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.1/lib/libvarnishcompat/srandomdev.c =================================================================== --- branches/1.1/lib/libvarnishcompat/srandomdev.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvarnishcompat/srandomdev.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.1/lib/libvarnishcompat/strndup.c =================================================================== --- branches/1.1/lib/libvarnishcompat/strndup.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvarnishcompat/strndup.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.1/lib/libvarnishcompat/vasprintf.c =================================================================== --- branches/1.1/lib/libvarnishcompat/vasprintf.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvarnishcompat/vasprintf.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.1/lib/libvcl/vcc_acl.c =================================================================== --- branches/1.1/lib/libvcl/vcc_acl.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvcl/vcc_acl.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/lib/libvcl/vcc_action.c =================================================================== --- branches/1.1/lib/libvcl/vcc_action.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvcl/vcc_action.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/lib/libvcl/vcc_backend.c =================================================================== --- branches/1.1/lib/libvcl/vcc_backend.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvcl/vcc_backend.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/lib/libvcl/vcc_compile.c =================================================================== --- branches/1.1/lib/libvcl/vcc_compile.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvcl/vcc_compile.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/lib/libvcl/vcc_compile.h =================================================================== --- branches/1.1/lib/libvcl/vcc_compile.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvcl/vcc_compile.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/lib/libvcl/vcc_fixed_token.c =================================================================== --- branches/1.1/lib/libvcl/vcc_fixed_token.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvcl/vcc_fixed_token.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -358,7 +358,7 @@ vsb_cat(sb, "};\n"); vsb_cat(sb, "/*-\n"); vsb_cat(sb, " * Copyright (c) 2006 Verdens Gang AS\n"); - vsb_cat(sb, " * Copyright (c) 2006-2007 Linpro AS\n"); + vsb_cat(sb, " * Copyright (c) 2006-2008 Linpro AS\n"); vsb_cat(sb, " * All rights reserved.\n"); vsb_cat(sb, " *\n"); vsb_cat(sb, " * Author: Poul-Henning Kamp \n"); Modified: branches/1.1/lib/libvcl/vcc_gen_fixed_token.tcl =================================================================== --- branches/1.1/lib/libvcl/vcc_gen_fixed_token.tcl 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvcl/vcc_gen_fixed_token.tcl 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,7 +1,7 @@ #!/usr/local/bin/tclsh8.4 #- # Copyright (c) 2006 Verdens Gang AS -# Copyright (c) 2006-2007 Linpro AS +# Copyright (c) 2006-2008 Linpro AS # All rights reserved. # # Author: Poul-Henning Kamp Modified: branches/1.1/lib/libvcl/vcc_gen_obj.tcl =================================================================== --- branches/1.1/lib/libvcl/vcc_gen_obj.tcl 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvcl/vcc_gen_obj.tcl 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,7 +1,7 @@ #!/usr/local/bin/tclsh8.4 #- # Copyright (c) 2006 Verdens Gang AS -# Copyright (c) 2006-2007 Linpro AS +# Copyright (c) 2006-2008 Linpro AS # All rights reserved. # # Author: Poul-Henning Kamp Modified: branches/1.1/lib/libvcl/vcc_parse.c =================================================================== --- branches/1.1/lib/libvcl/vcc_parse.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvcl/vcc_parse.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/lib/libvcl/vcc_priv.h =================================================================== --- branches/1.1/lib/libvcl/vcc_priv.h 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvcl/vcc_priv.h 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/lib/libvcl/vcc_string.c =================================================================== --- branches/1.1/lib/libvcl/vcc_string.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvcl/vcc_string.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/lib/libvcl/vcc_token.c =================================================================== --- branches/1.1/lib/libvcl/vcc_token.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvcl/vcc_token.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/lib/libvcl/vcc_var.c =================================================================== --- branches/1.1/lib/libvcl/vcc_var.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvcl/vcc_var.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/lib/libvcl/vcc_xref.c =================================================================== --- branches/1.1/lib/libvcl/vcc_xref.c 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/lib/libvcl/vcc_xref.c 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.1/man/vcl.7 =================================================================== --- branches/1.1/man/vcl.7 2008-02-17 09:03:32 UTC (rev 2494) +++ branches/1.1/man/vcl.7 2008-02-17 09:22:05 UTC (rev 2495) @@ -1,6 +1,6 @@ .\"- .\" Copyright (c) 2006 Verdens Gang AS -.\" Copyright (c) 2006-2007 Linpro AS +.\" Copyright (c) 2006-2008 Linpro AS .\" All rights reserved. .\" .\" Author: Dag-Erling Sm??rgrav From des at projects.linpro.no Sun Feb 17 09:26:32 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 17 Feb 2008 10:26:32 +0100 (CET) Subject: r2496 - in branches/1.2: . bin/varnishadm bin/varnishd bin/varnishhist bin/varnishlog bin/varnishncsa bin/varnishreplay bin/varnishstat bin/varnishtop include include/compat lib/libvarnish lib/libvarnishapi lib/libvarnishcompat lib/libvcl man Message-ID: <20080217092632.AC4CF1EC6B1@projects.linpro.no> Author: des Date: 2008-02-17 10:26:32 +0100 (Sun, 17 Feb 2008) New Revision: 2496 Modified: branches/1.2/ branches/1.2/LICENSE branches/1.2/bin/varnishadm/varnishadm.1 branches/1.2/bin/varnishadm/varnishadm.c branches/1.2/bin/varnishd/cache.h branches/1.2/bin/varnishd/cache_acceptor.c branches/1.2/bin/varnishd/cache_acceptor.h 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_backend_random.c branches/1.2/bin/varnishd/cache_backend_round_robin.c branches/1.2/bin/varnishd/cache_backend_simple.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/common.h branches/1.2/bin/varnishd/hash_classic.c branches/1.2/bin/varnishd/hash_simple_list.c branches/1.2/bin/varnishd/hash_slinger.h branches/1.2/bin/varnishd/heritage.h branches/1.2/bin/varnishd/mgt.h branches/1.2/bin/varnishd/mgt_child.c branches/1.2/bin/varnishd/mgt_cli.c branches/1.2/bin/varnishd/mgt_cli.h branches/1.2/bin/varnishd/mgt_event.c branches/1.2/bin/varnishd/mgt_event.h 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/steps.h branches/1.2/bin/varnishd/stevedore.c branches/1.2/bin/varnishd/stevedore.h 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.1 branches/1.2/bin/varnishd/varnishd.c branches/1.2/bin/varnishhist/varnishhist.1 branches/1.2/bin/varnishhist/varnishhist.c branches/1.2/bin/varnishlog/varnishlog.1 branches/1.2/bin/varnishlog/varnishlog.c branches/1.2/bin/varnishncsa/varnishncsa.1 branches/1.2/bin/varnishncsa/varnishncsa.c branches/1.2/bin/varnishreplay/varnishreplay.1 branches/1.2/bin/varnishreplay/varnishreplay.c branches/1.2/bin/varnishstat/varnishstat.1 branches/1.2/bin/varnishstat/varnishstat.c branches/1.2/bin/varnishtop/varnishtop.1 branches/1.2/bin/varnishtop/varnishtop.c branches/1.2/configure.ac branches/1.2/include/binary_heap.h branches/1.2/include/cli.h branches/1.2/include/cli_common.h branches/1.2/include/cli_priv.h branches/1.2/include/compat/asprintf.h branches/1.2/include/compat/daemon.h branches/1.2/include/compat/setproctitle.h branches/1.2/include/compat/srandomdev.h branches/1.2/include/compat/strlcat.h branches/1.2/include/compat/strlcpy.h branches/1.2/include/compat/strndup.h branches/1.2/include/compat/vasprintf.h branches/1.2/include/http_headers.h branches/1.2/include/libvarnish.h branches/1.2/include/libvcl.h branches/1.2/include/shmlog.h branches/1.2/include/shmlog_tags.h branches/1.2/include/stat_field.h branches/1.2/include/stats.h branches/1.2/include/varnishapi.h branches/1.2/include/vrt.h branches/1.2/include/vss.h 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/vss.c branches/1.2/lib/libvarnish/vtmpfile.c branches/1.2/lib/libvarnishapi/instance.c branches/1.2/lib/libvarnishapi/shmlog.c branches/1.2/lib/libvarnishcompat/asprintf.c branches/1.2/lib/libvarnishcompat/setproctitle.c branches/1.2/lib/libvarnishcompat/srandomdev.c branches/1.2/lib/libvarnishcompat/strndup.c branches/1.2/lib/libvarnishcompat/vasprintf.c 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_compile.h 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_parse.c branches/1.2/lib/libvcl/vcc_priv.h 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 branches/1.2/man/vcl.7 Log: Merged revisions 2270-2271,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317,2319,2321,2323-2327,2358,2362-2364,2366,2374,2376-2378,2380-2381,2384-2386,2414-2415,2426,2432-2434,2444-2445,2457,2492-2494 via svnmerge from svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache ........ r2270 | des | 2007-11-20 15:55:49 +0100 (Tue, 20 Nov 2007) | 7 lines Make SIGHUP work: VSL_Dispatch() will not return as long as it has data to feed to h_ncsa(), so it is up to h_ncsa() to interrupt it if reopen is non-zero. Also remove a superfluous call to VSL_Arg() as was previously done in varnishlog(1). ........ r2271 | des | 2007-11-20 15:56:21 +0100 (Tue, 20 Nov 2007) | 2 lines Fix some style issues, and harmonize with varnishncsa(1). ........ r2324 | des | 2007-12-20 14:57:31 +0100 (Thu, 20 Dec 2007) | 2 lines When writing to a file, fflush() after every line so tail -F will work. ........ r2414 | des | 2008-01-31 12:41:32 +0100 (Thu, 31 Jan 2008) | 3 lines Mention that varnishd(1) has a list of commands and parameters, and also how to obtain them from varnishd itself. ........ r2415 | des | 2008-01-31 12:57:51 +0100 (Thu, 31 Jan 2008) | 2 lines Update copyright; also convert a couple of files from ISO-8859-1 to UTF-8. ........ r2444 | des | 2008-02-10 19:00:33 +0100 (Sun, 10 Feb 2008) | 2 lines Alphabetize command-line options. ........ r2445 | des | 2008-02-11 03:58:41 +0100 (Mon, 11 Feb 2008) | 8 lines Separate the handling of backend and client requests, greatly simplifying both. Skip piped requests, and requests that are interrupted by an error. This should eliminate or at least greatly reduce the (null)s seen in logs. Fix a conditional that blocked backend requests from being printed. ........ r2457 | des | 2008-02-13 18:10:04 +0100 (Wed, 13 Feb 2008) | 2 lines SLT_Length is not relevant for backend requests. ........ r2492 | des | 2008-02-17 09:53:01 +0100 (Sun, 17 Feb 2008) | 2 lines Request is bogus if df_m, df_Uq or df_H are NULL (Coverity CID#2, CID#3) ........ r2493 | des | 2008-02-17 09:54:53 +0100 (Sun, 17 Feb 2008) | 2 lines Make sure buf is freed in error case (Coverity CID#9) ........ r2494 | des | 2008-02-17 10:03:32 +0100 (Sun, 17 Feb 2008) | 2 lines Free leftover buffers when the loop ends (Coverity CID#10) ........ 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,2375,2379 + /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 Modified: branches/1.2/LICENSE =================================================================== --- branches/1.2/LICENSE 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/LICENSE 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,5 +1,5 @@ Copyright (c) 2006 Verdens Gang AS -Copyright (c) 2006-2007 Linpro AS +Copyright (c) 2006-2008 Linpro AS All rights reserved. Redistribution and use in source and binary forms, with or without Modified: branches/1.2/bin/varnishadm/varnishadm.1 =================================================================== --- branches/1.2/bin/varnishadm/varnishadm.1 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishadm/varnishadm.1 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ .\"- .\" Copyright (c) 2006 Verdens Gang AS -.\" Copyright (c) 2006-2007 Linpro AS +.\" Copyright (c) 2006-2008 Linpro AS .\" All rights reserved. .\" .\" Author: Cecilie Fritzvold @@ -28,7 +28,7 @@ .\" .\" $Id$ .\" -.Dd September 12, 2007 +.Dd January 31, 2008 .Dt VARNISHADM 1 .Os .Sh NAME @@ -50,6 +50,15 @@ .It Fl T Ar address Ns : Ns Ar port Connect to the management interface at the specified address and port. .El +.Pp +Available commands and parameters are documented in the +.Xr varnishd 1 +manual page. +Additionally, a summary of commands can be obtained by issuing the +.Cm help +command, and a summary of parameters can be obtained by issuing the +.Cm param.show +command. .Sh EXIT STATUS The exit status of the .Nm Modified: branches/1.2/bin/varnishadm/varnishadm.c =================================================================== --- branches/1.2/bin/varnishadm/varnishadm.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishadm/varnishadm.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Cecilie Fritzvold Modified: branches/1.2/bin/varnishd/cache.h =================================================================== --- branches/1.2/bin/varnishd/cache.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_acceptor.c =================================================================== --- branches/1.2/bin/varnishd/cache_acceptor.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_acceptor.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_acceptor.h =================================================================== --- branches/1.2/bin/varnishd/cache_acceptor.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_acceptor.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_acceptor_epoll.c =================================================================== --- branches/1.2/bin/varnishd/cache_acceptor_epoll.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_acceptor_epoll.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: branches/1.2/bin/varnishd/cache_acceptor_kqueue.c =================================================================== --- branches/1.2/bin/varnishd/cache_acceptor_kqueue.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_acceptor_kqueue.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_acceptor_poll.c =================================================================== --- branches/1.2/bin/varnishd/cache_acceptor_poll.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_acceptor_poll.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_backend.c =================================================================== --- branches/1.2/bin/varnishd/cache_backend.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_backend.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_backend_random.c =================================================================== --- branches/1.2/bin/varnishd/cache_backend_random.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_backend_random.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Cecilie Fritzvold Modified: branches/1.2/bin/varnishd/cache_backend_round_robin.c =================================================================== --- branches/1.2/bin/varnishd/cache_backend_round_robin.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_backend_round_robin.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Cecilie Fritzvold Modified: branches/1.2/bin/varnishd/cache_backend_simple.c =================================================================== --- branches/1.2/bin/varnishd/cache_backend_simple.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_backend_simple.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_ban.c =================================================================== --- branches/1.2/bin/varnishd/cache_ban.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_ban.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_center.c =================================================================== --- branches/1.2/bin/varnishd/cache_center.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_center.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_cli.c =================================================================== --- branches/1.2/bin/varnishd/cache_cli.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_cli.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_expire.c =================================================================== --- branches/1.2/bin/varnishd/cache_expire.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_expire.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_fetch.c =================================================================== --- branches/1.2/bin/varnishd/cache_fetch.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_fetch.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_hash.c =================================================================== --- branches/1.2/bin/varnishd/cache_hash.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_hash.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_http.c =================================================================== --- branches/1.2/bin/varnishd/cache_http.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_http.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_httpconn.c =================================================================== --- branches/1.2/bin/varnishd/cache_httpconn.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_httpconn.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_main.c =================================================================== --- branches/1.2/bin/varnishd/cache_main.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_main.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_panic.c =================================================================== --- branches/1.2/bin/varnishd/cache_panic.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_panic.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.2/bin/varnishd/cache_pipe.c =================================================================== --- branches/1.2/bin/varnishd/cache_pipe.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_pipe.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_pool.c =================================================================== --- branches/1.2/bin/varnishd/cache_pool.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_pool.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_response.c =================================================================== --- branches/1.2/bin/varnishd/cache_response.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_response.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_session.c =================================================================== --- branches/1.2/bin/varnishd/cache_session.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_session.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_synthetic.c =================================================================== --- branches/1.2/bin/varnishd/cache_synthetic.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_synthetic.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007 Linpro AS + * Copyright (c) 2007-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.2/bin/varnishd/cache_vary.c =================================================================== --- branches/1.2/bin/varnishd/cache_vary.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_vary.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_vcl.c =================================================================== --- branches/1.2/bin/varnishd/cache_vcl.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_vcl.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_vrt.c =================================================================== --- branches/1.2/bin/varnishd/cache_vrt.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_vrt.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_vrt_acl.c =================================================================== --- branches/1.2/bin/varnishd/cache_vrt_acl.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_vrt_acl.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_vrt_esi.c =================================================================== --- branches/1.2/bin/varnishd/cache_vrt_esi.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_vrt_esi.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_vrt_re.c =================================================================== --- branches/1.2/bin/varnishd/cache_vrt_re.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_vrt_re.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/cache_ws.c =================================================================== --- branches/1.2/bin/varnishd/cache_ws.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/cache_ws.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/common.h =================================================================== --- branches/1.2/bin/varnishd/common.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/common.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/hash_classic.c =================================================================== --- branches/1.2/bin/varnishd/hash_classic.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/hash_classic.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/hash_simple_list.c =================================================================== --- branches/1.2/bin/varnishd/hash_simple_list.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/hash_simple_list.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/hash_slinger.h =================================================================== --- branches/1.2/bin/varnishd/hash_slinger.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/hash_slinger.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/heritage.h =================================================================== --- branches/1.2/bin/varnishd/heritage.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/heritage.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/mgt.h =================================================================== --- branches/1.2/bin/varnishd/mgt.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/mgt.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/mgt_child.c =================================================================== --- branches/1.2/bin/varnishd/mgt_child.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/mgt_child.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/mgt_cli.c =================================================================== --- branches/1.2/bin/varnishd/mgt_cli.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/mgt_cli.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/mgt_cli.h =================================================================== --- branches/1.2/bin/varnishd/mgt_cli.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/mgt_cli.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/mgt_event.c =================================================================== --- branches/1.2/bin/varnishd/mgt_event.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/mgt_event.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/mgt_event.h =================================================================== --- branches/1.2/bin/varnishd/mgt_event.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/mgt_event.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/mgt_param.c =================================================================== --- branches/1.2/bin/varnishd/mgt_param.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/mgt_param.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/mgt_vcc.c =================================================================== --- branches/1.2/bin/varnishd/mgt_vcc.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/mgt_vcc.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/rfc2616.c =================================================================== --- branches/1.2/bin/varnishd/rfc2616.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/rfc2616.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/shmlog.c =================================================================== --- branches/1.2/bin/varnishd/shmlog.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/shmlog.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/steps.h =================================================================== --- branches/1.2/bin/varnishd/steps.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/steps.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/stevedore.c =================================================================== --- branches/1.2/bin/varnishd/stevedore.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/stevedore.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007 Linpro AS + * Copyright (c) 2007-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm?rgav Modified: branches/1.2/bin/varnishd/stevedore.h =================================================================== --- branches/1.2/bin/varnishd/stevedore.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/stevedore.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/storage_file.c =================================================================== --- branches/1.2/bin/varnishd/storage_file.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/storage_file.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/storage_malloc.c =================================================================== --- branches/1.2/bin/varnishd/storage_malloc.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/storage_malloc.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/tcp.c =================================================================== --- branches/1.2/bin/varnishd/tcp.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/tcp.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishd/varnishd.1 =================================================================== --- branches/1.2/bin/varnishd/varnishd.1 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/varnishd.1 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ .\"- .\" Copyright (c) 2006 Verdens Gang AS -.\" Copyright (c) 2006-2007 Linpro AS +.\" Copyright (c) 2006-2008 Linpro AS .\" All rights reserved. .\" .\" Author: Dag-Erling Sm??rgrav Modified: branches/1.2/bin/varnishd/varnishd.c =================================================================== --- branches/1.2/bin/varnishd/varnishd.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishd/varnishd.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishhist/varnishhist.1 =================================================================== --- branches/1.2/bin/varnishhist/varnishhist.1 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishhist/varnishhist.1 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ .\"- .\" Copyright (c) 2006 Verdens Gang AS -.\" Copyright (c) 2006-2007 Linpro AS +.\" Copyright (c) 2006-2008 Linpro AS .\" All rights reserved. .\" .\" Author: Dag-Erling Sm??rgrav Modified: branches/1.2/bin/varnishhist/varnishhist.c =================================================================== --- branches/1.2/bin/varnishhist/varnishhist.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishhist/varnishhist.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishlog/varnishlog.1 =================================================================== --- branches/1.2/bin/varnishlog/varnishlog.1 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishlog/varnishlog.1 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ .\"- .\" Copyright (c) 2006 Verdens Gang AS -.\" Copyright (c) 2006-2007 Linpro AS +.\" Copyright (c) 2006-2008 Linpro AS .\" All rights reserved. .\" .\" Author: Dag-Erling Sm??rgrav Modified: branches/1.2/bin/varnishlog/varnishlog.c =================================================================== --- branches/1.2/bin/varnishlog/varnishlog.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishlog/varnishlog.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp @@ -179,14 +179,14 @@ match_tag = name2tag(argv[0]); if (match_tag < 0) { fprintf(stderr, "Tag \"%s\" unknown\n", argv[0]); - exit (2); + exit(2); } i = regcomp(&match_re, argv[1], REG_EXTENDED | REG_NOSUB); if (i) { char buf[BUFSIZ]; regerror(i, &match_re, buf, sizeof buf); fprintf(stderr, "%s\n", buf); - exit (2); + exit(2); } } if (!b_flag) { @@ -235,7 +235,7 @@ fd = open(w_arg, flags, 0644); if (fd < 0) { perror(w_arg); - exit (1); + exit(1); } return (fd); } @@ -265,7 +265,7 @@ reopen = 0; } } - exit (0); + exit(0); } /*--------------------------------------------------------------------*/ @@ -281,7 +281,7 @@ int main(int argc, char **argv) { - int i, c; + int c; int a_flag = 0, D_flag = 0, o_flag = 0; const char *n_arg = NULL; const char *P_arg = NULL; @@ -296,6 +296,14 @@ case 'a': a_flag = 1; break; + case 'b': + b_flag = 1; + VSL_Arg(vd, c, optarg); + break; + case 'c': + c_flag = 1; + VSL_Arg(vd, c, optarg); + break; case 'D': D_flag = 1; break; @@ -314,16 +322,6 @@ case 'w': w_arg = optarg; break; - case 'c': - c_flag = 1; - if (VSL_Arg(vd, c, optarg) > 0) - break; - usage(); - case 'b': - b_flag = 1; - if (VSL_Arg(vd, c, optarg) > 0) - break; - usage(); default: if (VSL_Arg(vd, c, optarg) > 0) break; @@ -358,12 +356,11 @@ if (o_flag) do_order(vd, argc - optind, argv + optind); - while (1) { - i = VSL_Dispatch(vd, VSL_H_Print, stdout); - if (i == 0) - fflush(stdout); - else if (i < 0) + while (VSL_Dispatch(vd, VSL_H_Print, stdout) >= 0) { + if (fflush(stdout) != 0) { + perror("stdout"); break; + } } if (pfh != NULL) Modified: branches/1.2/bin/varnishncsa/varnishncsa.1 =================================================================== --- branches/1.2/bin/varnishncsa/varnishncsa.1 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishncsa/varnishncsa.1 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ .\"- .\" Copyright (c) 2006 Verdens Gang AS -.\" Copyright (c) 2006-2007 Linpro AS +.\" Copyright (c) 2006-2008 Linpro AS .\" All rights reserved. .\" .\" Author: Dag-Erling Sm??rgrav Modified: branches/1.2/bin/varnishncsa/varnishncsa.c =================================================================== --- branches/1.2/bin/varnishncsa/varnishncsa.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishncsa/varnishncsa.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Anders Berg @@ -80,6 +80,8 @@ #include "shmlog.h" #include "varnishapi.h" +static volatile sig_atomic_t reopen; + static struct logline { char *df_H; /* %H, Protocol version */ char *df_Host; /* %{Host}i */ @@ -90,14 +92,13 @@ char *df_h; /* %h (host name / IP adress)*/ char *df_m; /* %m, Request method*/ char *df_s; /* %s, Status */ + struct tm df_t; /* %t, Date and time */ char *df_u; /* %u, Remote user */ int bogus; /* bogus request */ } **ll; static size_t nll; -static time_t t; - static int isprefix(const char *str, const char *prefix, const char *end, const char **next) { @@ -173,53 +174,98 @@ } static int -h_ncsa(void *priv, enum shmlogtag tag, unsigned fd, - unsigned len, unsigned spec, const char *ptr) +collect_backend(struct logline *lp, enum shmlogtag tag, unsigned spec, + const char *ptr, unsigned len) { const char *end, *next; - char *q; - FILE *fo; - long l; - struct tm tm; - char tbuf[40]; - struct logline *lp; + assert(spec & VSL_S_BACKEND); end = ptr + len; - if (!(spec & VSL_S_CLIENT || spec & VSL_S_BACKEND)) - return (0); - - if (fd >= nll) { - struct logline **newll = ll; - size_t newnll = nll; - - while (fd >= newnll) - newnll += newnll + 1; - newll = realloc(newll, newnll * sizeof *newll); - assert(newll != NULL); - memset(newll + nll, 0, (newnll - nll) * sizeof *newll); - ll = newll; - nll = newnll; - } - if (ll[fd] == NULL) { - ll[fd] = calloc(sizeof *ll[fd], 1); - assert(ll[fd] != NULL); - } - lp = ll[fd]; - switch (tag) { case SLT_BackendOpen: - if (!(spec & VSL_S_BACKEND)) - break; if (lp->df_h != NULL) lp->bogus = 1; - else { + else if (isprefix(ptr, "default", end, &next)) lp->df_h = trimfield(next, end); else lp->df_h = trimfield(ptr, end); - } break; + + case SLT_TxRequest: + if (lp->df_m != NULL) + lp->bogus = 1; + else + lp->df_m = trimline(ptr, end); + break; + + case SLT_TxURL: + if (lp->df_Uq != NULL) + lp->bogus = 1; + else + lp->df_Uq = trimline(ptr, end); + break; + + case SLT_TxProtocol: + if (lp->df_H != NULL) + lp->bogus = 1; + else + lp->df_H = trimline(ptr, end); + break; + + case SLT_RxStatus: + if (lp->df_s != NULL) + lp->bogus = 1; + else + lp->df_s = trimline(ptr, end); + break; + + case SLT_RxHeader: + if (isprefix(ptr, "content-length:", end, &next)) + lp->df_b = trimline(next, end); + else if (isprefix(ptr, "date:", end, &next) && + strptime(next, "%a, %d %b %Y %T", &lp->df_t) == NULL) + lp->bogus = 1; + break; + + case SLT_TxHeader: + if (isprefix(ptr, "user-agent:", end, &next)) + lp->df_User_agent = trimline(next, end); + else if (isprefix(ptr, "referer:", end, &next)) + lp->df_Referer = trimline(next, end); + else if (isprefix(ptr, "authorization:", end, &next) && + isprefix(next, "basic", end, &next)) + lp->df_u = trimline(next, end); + else if (isprefix(ptr, "host:", end, &next)) + lp->df_Host = trimline(next, end); + break; + + case SLT_BackendReuse: + case SLT_BackendClose: + /* got it all */ + return (0); + + default: + break; + } + + /* more to come */ + return (1); +} + +static int +collect_client(struct logline *lp, enum shmlogtag tag, unsigned spec, + const char *ptr, unsigned len) +{ + const char *end, *next; + long l; + time_t t; + + assert(spec & VSL_S_CLIENT); + end = ptr + len; + + switch (tag) { case SLT_ReqStart: if (lp->df_h != NULL) lp->bogus = 1; @@ -227,71 +273,35 @@ lp->df_h = trimfield(ptr, end); break; - case SLT_TxRequest: - if (!(spec & VSL_S_BACKEND)) - break; case SLT_RxRequest: - if (tag == SLT_RxRequest && (spec & VSL_S_BACKEND)) - break; - if (lp->df_m != NULL) lp->bogus = 1; else lp->df_m = trimline(ptr, end); break; - case SLT_TxURL: - if (!(spec & VSL_S_BACKEND)) - break; case SLT_RxURL: - if (tag == SLT_RxURL && (spec & VSL_S_BACKEND)) - break; - if (lp->df_Uq != NULL) lp->bogus = 1; else lp->df_Uq = trimline(ptr, end); break; - case SLT_TxProtocol: - if (!(spec & VSL_S_BACKEND)) - break; case SLT_RxProtocol: - if (tag == SLT_RxProtocol && (spec & VSL_S_BACKEND)) - break; - if (lp->df_H != NULL) lp->bogus = 1; else lp->df_H = trimline(ptr, end); break; - case SLT_RxStatus: - if (!(spec & VSL_S_BACKEND)) - break; case SLT_TxStatus: - if (tag == SLT_TxStatus && (spec & VSL_S_BACKEND)) - break; - if (lp->df_s != NULL) lp->bogus = 1; else lp->df_s = trimline(ptr, end); break; - case SLT_TxHeader: - if (!(spec & VSL_S_BACKEND)) - break; case SLT_RxHeader: - if (tag == SLT_RxHeader && (spec & VSL_S_BACKEND)) { - if (isprefix(ptr, "content-length:", end, &next)) { - lp->df_b = trimline(next, end); - } else if (isprefix(ptr, "date:", end, &next)) { - if (strptime(trimline(next, end), "%a, %d %b %Y %T", &tm)) - t = mktime(&tm); - } - break; - } if (isprefix(ptr, "user-agent:", end, &next)) lp->df_User_agent = trimline(next, end); else if (isprefix(ptr, "referer:", end, &next)) @@ -310,24 +320,73 @@ lp->df_b = trimline(ptr, end); break; + case SLT_SessionClose: + if (strncmp(ptr, "pipe", len) == 0 || + strncmp(ptr, "error", len) == 0) + lp->bogus = 1; + break; + + case SLT_ReqEnd: + if (sscanf(ptr, "%*u %*u.%*u %ld.", &l) != 1) { + lp->bogus = 1; + } else { + t = l; + localtime_r(&t, &lp->df_t); + } + /* got it all */ + return (0); + default: break; } - if ((spec & VSL_S_CLIENT) && tag != SLT_ReqEnd) - return (0); + /* more to come */ + return (1); +} - if ((spec & VSL_S_BACKEND) && tag != SLT_BackendReuse && - (tag != SLT_BackendClose || lp->df_Uq)) - return (0); +static int +h_ncsa(void *priv, enum shmlogtag tag, unsigned fd, + unsigned len, unsigned spec, const char *ptr) +{ + struct logline *lp; + FILE *fo = priv; + char *q, tbuf[64]; - if (tag == SLT_ReqEnd) { - if (sscanf(ptr, "%*u %*u.%*u %ld.", &l) != 1) - lp->bogus = 1; - else - t = l; + if (fd >= nll) { + struct logline **newll = ll; + size_t newnll = nll; + + while (fd >= newnll) + newnll += newnll + 1; + newll = realloc(newll, newnll * sizeof *newll); + assert(newll != NULL); + memset(newll + nll, 0, (newnll - nll) * sizeof *newll); + ll = newll; + nll = newnll; } + if (ll[fd] == NULL) { + ll[fd] = calloc(sizeof *ll[fd], 1); + assert(ll[fd] != NULL); + } + lp = ll[fd]; + if (spec & VSL_S_BACKEND) { + if (collect_backend(lp, tag, spec, ptr, len)) + return (reopen); + } else if (spec & VSL_S_CLIENT) { + if (collect_client(lp, tag, spec, ptr, len)) + return (reopen); + } else { + /* huh? */ + return (reopen); + } + +#if 0 + /* non-optional fields */ + if (!lp->df_m || !lp->df_Uq || !lp->df_H || !lp->df_s) + lp->bogus = 1; +#endif + if (!lp->bogus) { fo = priv; @@ -360,8 +419,7 @@ } /* %t */ - localtime_r(&t, &tm); - strftime(tbuf, sizeof tbuf, "[%d/%b/%Y:%T %z]", &tm); + strftime(tbuf, sizeof tbuf, "[%d/%b/%Y:%T %z]", &lp->df_t); fprintf(fo, "%s ", tbuf); /* @@ -381,7 +439,7 @@ fprintf(fo, "%s ", lp->df_s); /* %b */ - fprintf(fo, "%s ", lp->df_b); + fprintf(fo, "%s ", lp->df_b ? lp->df_b : "-"); /* %{Referer}i */ fprintf(fo, "\"%s\" ", @@ -390,6 +448,10 @@ /* %{User-agent}i */ fprintf(fo, "\"%s\"\n", lp->df_User_agent ? lp->df_User_agent : "-"); + + /* hack: flush after every line if writing to file */ + if (fo != stdout) + fflush(fo); } /* clean up */ @@ -405,15 +467,13 @@ freez(lp->df_s); freez(lp->df_u); #undef freez - lp->bogus = 0; + memset(lp, 0, sizeof *lp); - return (0); + return (reopen); } /*--------------------------------------------------------------------*/ -static volatile sig_atomic_t reopen; - static void sighup(int sig) { @@ -447,7 +507,7 @@ int main(int argc, char *argv[]) { - int i, c; + int c; int a_flag = 0, D_flag = 0; const char *n_arg = NULL; const char *P_arg = NULL; @@ -459,11 +519,6 @@ vd = VSL_New(); while ((c = getopt(argc, argv, VSL_ARGS "aDn:P:Vw:")) != -1) { - i = VSL_Arg(vd, c, optarg); - if (i < 0) - exit (1); - if (i > 0) - continue; switch (c) { case 'a': a_flag = 1; @@ -516,7 +571,7 @@ of = stdout; } - while (VSL_Dispatch(vd, h_ncsa, of) == 0) { + while (VSL_Dispatch(vd, h_ncsa, of) >= 0) { if (fflush(of) != 0) { perror(w_arg); exit(1); Modified: branches/1.2/bin/varnishreplay/varnishreplay.1 =================================================================== --- branches/1.2/bin/varnishreplay/varnishreplay.1 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishreplay/varnishreplay.1 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,5 +1,5 @@ .\"- -.\" Copyright (c) 2007 Linpro AS +.\" Copyright (c) 2007-2008 Linpro AS .\" All rights reserved. .\" .\" Author: Cecilie Fritzvold Modified: branches/1.2/bin/varnishreplay/varnishreplay.c =================================================================== --- branches/1.2/bin/varnishreplay/varnishreplay.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishreplay/varnishreplay.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -361,7 +361,8 @@ (2048 < length - nbuf ? 2048 : length - nbuf)); if (n <= 0) { thread_log(0, "failed reading the block\n"); - return (-1); + nbuf = -1; + break; } nbuf += n; } @@ -519,6 +520,9 @@ if (tag != SLT_ReqEnd) continue; + if (!df_m || !df_Uq || !df_H) + bogus = 1; + if (bogus) { thread_log(1, "bogus\n"); } else { @@ -579,6 +583,16 @@ freez(df_c); bogus = 0; } + + /* leftovers */ + freez(msg->ptr); + freez(msg); + freez(df_H); + freez(df_Host); + freez(df_Uq); + freez(df_m); + freez(df_c); + return (0); } Modified: branches/1.2/bin/varnishstat/varnishstat.1 =================================================================== --- branches/1.2/bin/varnishstat/varnishstat.1 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishstat/varnishstat.1 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ .\"- .\" Copyright (c) 2006 Verdens Gang AS -.\" Copyright (c) 2006-2007 Linpro AS +.\" Copyright (c) 2006-2008 Linpro AS .\" All rights reserved. .\" .\" Author: Dag-Erling Sm??rgrav Modified: branches/1.2/bin/varnishstat/varnishstat.c =================================================================== --- branches/1.2/bin/varnishstat/varnishstat.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishstat/varnishstat.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/bin/varnishtop/varnishtop.1 =================================================================== --- branches/1.2/bin/varnishtop/varnishtop.1 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishtop/varnishtop.1 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ .\"- .\" Copyright (c) 2006 Verdens Gang AS -.\" Copyright (c) 2006-2007 Linpro AS +.\" Copyright (c) 2006-2008 Linpro AS .\" All rights reserved. .\" .\" Author: Dag-Erling Sm??rgrav Modified: branches/1.2/bin/varnishtop/varnishtop.c =================================================================== --- branches/1.2/bin/varnishtop/varnishtop.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/bin/varnishtop/varnishtop.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/configure.ac =================================================================== --- branches/1.2/configure.ac 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/configure.ac 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,7 +1,7 @@ # $Id$ AC_PREREQ(2.59) -AC_COPYRIGHT([Copyright (c) 2006-2007 Linpro AS / Verdens Gang AS]) +AC_COPYRIGHT([Copyright (c) 2006-2008 Linpro AS / Verdens Gang AS]) AC_REVISION([$Id$]) AC_INIT([Varnish], [1.2], [varnish-dev at projects.linpro.no]) AC_CONFIG_SRCDIR(include/varnishapi.h) Modified: branches/1.2/include/binary_heap.h =================================================================== --- branches/1.2/include/binary_heap.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/include/binary_heap.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/include/cli.h =================================================================== --- branches/1.2/include/cli.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/include/cli.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/include/cli_common.h =================================================================== --- branches/1.2/include/cli_common.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/include/cli_common.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/include/cli_priv.h =================================================================== --- branches/1.2/include/cli_priv.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/include/cli_priv.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/include/compat/asprintf.h =================================================================== --- branches/1.2/include/compat/asprintf.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/include/compat/asprintf.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.2/include/compat/daemon.h =================================================================== --- branches/1.2/include/compat/daemon.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/include/compat/daemon.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.2/include/compat/setproctitle.h =================================================================== --- branches/1.2/include/compat/setproctitle.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/include/compat/setproctitle.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.2/include/compat/srandomdev.h =================================================================== --- branches/1.2/include/compat/srandomdev.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/include/compat/srandomdev.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.2/include/compat/strlcat.h =================================================================== --- branches/1.2/include/compat/strlcat.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/include/compat/strlcat.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.2/include/compat/strlcpy.h =================================================================== --- branches/1.2/include/compat/strlcpy.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/include/compat/strlcpy.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.2/include/compat/strndup.h =================================================================== --- branches/1.2/include/compat/strndup.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/include/compat/strndup.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.2/include/compat/vasprintf.h =================================================================== --- branches/1.2/include/compat/vasprintf.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/include/compat/vasprintf.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.2/include/http_headers.h =================================================================== --- branches/1.2/include/http_headers.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/include/http_headers.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/include/libvarnish.h =================================================================== --- branches/1.2/include/libvarnish.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/include/libvarnish.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/include/libvcl.h =================================================================== --- branches/1.2/include/libvcl.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/include/libvcl.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/include/shmlog.h =================================================================== --- branches/1.2/include/shmlog.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/include/shmlog.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/include/shmlog_tags.h =================================================================== --- branches/1.2/include/shmlog_tags.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/include/shmlog_tags.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/include/stat_field.h =================================================================== --- branches/1.2/include/stat_field.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/include/stat_field.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/include/stats.h =================================================================== --- branches/1.2/include/stats.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/include/stats.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/include/varnishapi.h =================================================================== --- branches/1.2/include/varnishapi.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/include/varnishapi.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/include/vrt.h =================================================================== --- branches/1.2/include/vrt.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/include/vrt.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/include/vss.h =================================================================== --- branches/1.2/include/vss.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/include/vss.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: branches/1.2/lib/libvarnish/argv.c =================================================================== --- branches/1.2/lib/libvarnish/argv.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvarnish/argv.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/lib/libvarnish/assert.c =================================================================== --- branches/1.2/lib/libvarnish/assert.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvarnish/assert.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/lib/libvarnish/binary_heap.c =================================================================== --- branches/1.2/lib/libvarnish/binary_heap.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvarnish/binary_heap.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/lib/libvarnish/cli.c =================================================================== --- branches/1.2/lib/libvarnish/cli.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvarnish/cli.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/lib/libvarnish/cli_common.c =================================================================== --- branches/1.2/lib/libvarnish/cli_common.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvarnish/cli_common.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/lib/libvarnish/crc32.c =================================================================== --- branches/1.2/lib/libvarnish/crc32.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvarnish/crc32.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/lib/libvarnish/flopen.c =================================================================== --- branches/1.2/lib/libvarnish/flopen.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvarnish/flopen.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007 Dag-Erling Co?dan Sm?rgrav + * Copyright (c) 2007 Dag-Erling Co??dan Sm??rgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: branches/1.2/lib/libvarnish/time.c =================================================================== --- branches/1.2/lib/libvarnish/time.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvarnish/time.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/lib/libvarnish/version.c =================================================================== --- branches/1.2/lib/libvarnish/version.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvarnish/version.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav @@ -40,5 +40,5 @@ { fprintf(stderr, "%s (%s-%s)\n", progname, PACKAGE_TARNAME, PACKAGE_VERSION); - fprintf(stderr, "Copyright (c) 2006-2007 Linpro AS / Verdens Gang AS\n"); + fprintf(stderr, "Copyright (c) 2006-2008 Linpro AS / Verdens Gang AS\n"); } Modified: branches/1.2/lib/libvarnish/vss.c =================================================================== --- branches/1.2/lib/libvarnish/vss.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvarnish/vss.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.2/lib/libvarnish/vtmpfile.c =================================================================== --- branches/1.2/lib/libvarnish/vtmpfile.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvarnish/vtmpfile.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,9 +1,9 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * - * Author: Dag-Erling Sm?rgrav + * Author: Dag-Erling Sm??rgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: branches/1.2/lib/libvarnishapi/instance.c =================================================================== --- branches/1.2/lib/libvarnishapi/instance.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvarnishapi/instance.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007 Linpro AS + * Copyright (c) 2007-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.2/lib/libvarnishapi/shmlog.c =================================================================== --- branches/1.2/lib/libvarnishapi/shmlog.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvarnishapi/shmlog.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/lib/libvarnishcompat/asprintf.c =================================================================== --- branches/1.2/lib/libvarnishcompat/asprintf.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvarnishcompat/asprintf.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.2/lib/libvarnishcompat/setproctitle.c =================================================================== --- branches/1.2/lib/libvarnishcompat/setproctitle.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvarnishcompat/setproctitle.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.2/lib/libvarnishcompat/srandomdev.c =================================================================== --- branches/1.2/lib/libvarnishcompat/srandomdev.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvarnishcompat/srandomdev.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.2/lib/libvarnishcompat/strndup.c =================================================================== --- branches/1.2/lib/libvarnishcompat/strndup.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvarnishcompat/strndup.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.2/lib/libvarnishcompat/vasprintf.c =================================================================== --- branches/1.2/lib/libvarnishcompat/vasprintf.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvarnishcompat/vasprintf.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Dag-Erling Sm??rgrav Modified: branches/1.2/lib/libvcl/vcc_acl.c =================================================================== --- branches/1.2/lib/libvcl/vcc_acl.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvcl/vcc_acl.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/lib/libvcl/vcc_action.c =================================================================== --- branches/1.2/lib/libvcl/vcc_action.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvcl/vcc_action.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/lib/libvcl/vcc_backend.c =================================================================== --- branches/1.2/lib/libvcl/vcc_backend.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvcl/vcc_backend.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/lib/libvcl/vcc_compile.c =================================================================== --- branches/1.2/lib/libvcl/vcc_compile.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvcl/vcc_compile.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/lib/libvcl/vcc_compile.h =================================================================== --- branches/1.2/lib/libvcl/vcc_compile.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvcl/vcc_compile.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/lib/libvcl/vcc_fixed_token.c =================================================================== --- branches/1.2/lib/libvcl/vcc_fixed_token.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvcl/vcc_fixed_token.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -379,7 +379,7 @@ vsb_cat(sb, "};\n"); vsb_cat(sb, "/*-\n"); vsb_cat(sb, " * Copyright (c) 2006 Verdens Gang AS\n"); - vsb_cat(sb, " * Copyright (c) 2006-2007 Linpro AS\n"); + vsb_cat(sb, " * Copyright (c) 2006-2008 Linpro AS\n"); vsb_cat(sb, " * All rights reserved.\n"); vsb_cat(sb, " *\n"); vsb_cat(sb, " * Author: Poul-Henning Kamp \n"); Modified: branches/1.2/lib/libvcl/vcc_gen_fixed_token.tcl =================================================================== --- branches/1.2/lib/libvcl/vcc_gen_fixed_token.tcl 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvcl/vcc_gen_fixed_token.tcl 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,7 +1,7 @@ #!/usr/local/bin/tclsh8.4 #- # Copyright (c) 2006 Verdens Gang AS -# Copyright (c) 2006-2007 Linpro AS +# Copyright (c) 2006-2008 Linpro AS # All rights reserved. # # Author: Poul-Henning Kamp Modified: branches/1.2/lib/libvcl/vcc_gen_obj.tcl =================================================================== --- branches/1.2/lib/libvcl/vcc_gen_obj.tcl 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvcl/vcc_gen_obj.tcl 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,7 +1,7 @@ #!/usr/local/bin/tclsh8.4 #- # Copyright (c) 2006 Verdens Gang AS -# Copyright (c) 2006-2007 Linpro AS +# Copyright (c) 2006-2008 Linpro AS # All rights reserved. # # Author: Poul-Henning Kamp Modified: branches/1.2/lib/libvcl/vcc_parse.c =================================================================== --- branches/1.2/lib/libvcl/vcc_parse.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvcl/vcc_parse.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/lib/libvcl/vcc_priv.h =================================================================== --- branches/1.2/lib/libvcl/vcc_priv.h 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvcl/vcc_priv.h 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/lib/libvcl/vcc_string.c =================================================================== --- branches/1.2/lib/libvcl/vcc_string.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvcl/vcc_string.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/lib/libvcl/vcc_token.c =================================================================== --- branches/1.2/lib/libvcl/vcc_token.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvcl/vcc_token.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/lib/libvcl/vcc_var.c =================================================================== --- branches/1.2/lib/libvcl/vcc_var.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvcl/vcc_var.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/lib/libvcl/vcc_xref.c =================================================================== --- branches/1.2/lib/libvcl/vcc_xref.c 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/lib/libvcl/vcc_xref.c 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2007 Linpro AS + * Copyright (c) 2006-2008 Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp Modified: branches/1.2/man/vcl.7 =================================================================== --- branches/1.2/man/vcl.7 2008-02-17 09:22:05 UTC (rev 2495) +++ branches/1.2/man/vcl.7 2008-02-17 09:26:32 UTC (rev 2496) @@ -1,6 +1,6 @@ .\"- .\" Copyright (c) 2006 Verdens Gang AS -.\" Copyright (c) 2006-2007 Linpro AS +.\" Copyright (c) 2006-2008 Linpro AS .\" All rights reserved. .\" .\" Author: Dag-Erling Sm??rgrav From des at projects.linpro.no Sun Feb 17 09:28:24 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 17 Feb 2008 10:28:24 +0100 (CET) Subject: r2497 - trunk/varnish-tools Message-ID: <20080217092824.AEC1E1EC384@projects.linpro.no> Author: des Date: 2008-02-17 10:28:24 +0100 (Sun, 17 Feb 2008) New Revision: 2497 Removed: trunk/varnish-tools/licensify/ Log: No longer necessary From des at projects.linpro.no Sun Feb 17 09:28:44 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 17 Feb 2008 10:28:44 +0100 (CET) Subject: r2498 - trunk/varnish-tools Message-ID: <20080217092844.C95DF1EC21C@projects.linpro.no> Author: des Date: 2008-02-17 10:28:44 +0100 (Sun, 17 Feb 2008) New Revision: 2498 Removed: trunk/varnish-tools/recursor/ Log: No longer necessary From des at projects.linpro.no Sun Feb 17 09:32:50 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 17 Feb 2008 10:32:50 +0100 (CET) Subject: r2499 - in trunk/varnish-tools: . firefox firefox/chrome firefox/chrome/content firefox/chrome/icons firefox/defaults Message-ID: <20080217093250.CCB2E1EC6B1@projects.linpro.no> Author: des Date: 2008-02-17 10:32:50 +0100 (Sun, 17 Feb 2008) New Revision: 2499 Added: trunk/varnish-tools/firefox/ trunk/varnish-tools/firefox/Makefile trunk/varnish-tools/firefox/chrome.manifest trunk/varnish-tools/firefox/chrome/ trunk/varnish-tools/firefox/chrome/content/ trunk/varnish-tools/firefox/chrome/content/varnish-icon-red-32.gif trunk/varnish-tools/firefox/chrome/content/varnish.js trunk/varnish-tools/firefox/chrome/content/varnish.xul trunk/varnish-tools/firefox/chrome/icons/ trunk/varnish-tools/firefox/chrome/icons/default/ trunk/varnish-tools/firefox/components/ trunk/varnish-tools/firefox/defaults/ trunk/varnish-tools/firefox/defaults/preferences/ trunk/varnish-tools/firefox/install.rdf trunk/varnish-tools/firefox/plugins/ Log: Unfinished Firefox plugin. Added: trunk/varnish-tools/firefox/Makefile =================================================================== --- trunk/varnish-tools/firefox/Makefile (rev 0) +++ trunk/varnish-tools/firefox/Makefile 2008-02-17 09:32:50 UTC (rev 2499) @@ -0,0 +1,15 @@ +# $Id$ + +CHROME_CONTENT = \ + chrome/content/varnish-icon-red-32.gif \ + chrome/content/varnish.xul \ + +FILES = \ + install.rdf \ + chrome.manifest \ + ${CHROME_CONTENT} + +all: varnish.xpi + +varnish.xpi: ${FILES} + zip $@ ${FILES} Property changes on: trunk/varnish-tools/firefox/Makefile ___________________________________________________________________ Name: svn:keywords + Id Name: svn:eol-style + native Added: trunk/varnish-tools/firefox/chrome/content/varnish-icon-red-32.gif =================================================================== (Binary files differ) Property changes on: trunk/varnish-tools/firefox/chrome/content/varnish-icon-red-32.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/varnish-tools/firefox/chrome/content/varnish.js =================================================================== --- trunk/varnish-tools/firefox/chrome/content/varnish.js (rev 0) +++ trunk/varnish-tools/firefox/chrome/content/varnish.js 2008-02-17 09:32:50 UTC (rev 2499) @@ -0,0 +1,37 @@ +// $Id$ + +var varnish = { + rebuild: function() { + } +}; + +function varnish_register() +{ + window.getBrowser().addProgressListener(varnish_progress_listener); +} + +function varnish_unregister() +{ + window.getBrowser().removeProgressListener(varnish_progress_listener); +} + +window.addEventListener("load", varnish_register, false); +window.addEventListener("unload", varnish_unregister, false); + +var varnish_progress_listener = { + onLocationChange: function(webProgress, request, location) { + }, + + onProgressChange: function(webProgress, request, curSelfProgress, + maxSelfProgress, curTotalProgress, maxTotalProgress) { + }, + + onSecurityChange: function(webProgress, request, state) { + }, + + onStateChange: function(webProgress, request, stateFlags, status) { + }, + + onStatusChange: function(webProgress, request, status, message) { + }, +}; Property changes on: trunk/varnish-tools/firefox/chrome/content/varnish.js ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/varnish-tools/firefox/chrome/content/varnish.xul =================================================================== --- trunk/varnish-tools/firefox/chrome/content/varnish.xul (rev 0) +++ trunk/varnish-tools/firefox/chrome/content/varnish.xul 2008-02-17 09:32:50 UTC (rev 2499) @@ -0,0 +1,8 @@ + + + +