r2573 - in branches/1.2: . bin/varnishlog include lib/libvarnishapi
des at projects.linpro.no
des at projects.linpro.no
Sat Mar 8 17:56:56 CET 2008
Author: des
Date: 2008-03-08 17:56:55 +0100 (Sat, 08 Mar 2008)
New Revision: 2573
Modified:
branches/1.2/
branches/1.2/bin/varnishlog/varnishlog.1
branches/1.2/include/varnishapi.h
branches/1.2/lib/libvarnishapi/shmlog.c
Log:
Merged revisions 2572 via svnmerge from
svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache
........
r2572 | des | 2008-03-08 17:55:22 +0100 (Sat, 08 Mar 2008) | 2 lines
Add a -s option which specifies a number of entries to skip.
........
Property changes on: branches/1.2
___________________________________________________________________
Name: svnmerge-integrated
- /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317,2319,2321-2327,2337,2358,2362-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2522-2524,2545,2563-2565,2569
+ /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2270-2271,2296-2297,2299,2304-2305,2307-2309,2311-2312,2315,2317,2319,2321-2327,2337,2358,2362-2364,2366,2374-2382,2384-2386,2404,2414-2415,2426,2432-2434,2444-2445,2453-2461,2467,2492-2505,2522-2524,2545,2563-2565,2569,2572
Modified: branches/1.2/bin/varnishlog/varnishlog.1
===================================================================
--- branches/1.2/bin/varnishlog/varnishlog.1 2008-03-08 16:55:22 UTC (rev 2572)
+++ branches/1.2/bin/varnishlog/varnishlog.1 2008-03-08 16:56:55 UTC (rev 2573)
@@ -28,7 +28,7 @@
.\"
.\" $Id$
.\"
-.Dd November 8, 2007
+.Dd March 8, 2008
.Dt VARNISHLOG 1
.Os
.Sh NAME
@@ -48,6 +48,7 @@
.Op Fl o
.Op Fl P Ar file
.Op Fl r Ar file
+.Op Fl s Ar num
.Op Fl V
.Op Fl w Ar file
.Op Fl X Ar regex
@@ -126,6 +127,10 @@
Read log entries from
.Ar file
instead of shared memory.
+.It Fl s Ar num
+Skip the first
+.Ar num
+log records.
.It Fl V
Display the version number and exit.
.It Fl w Ar file
Modified: branches/1.2/include/varnishapi.h
===================================================================
--- branches/1.2/include/varnishapi.h 2008-03-08 16:55:22 UTC (rev 2572)
+++ branches/1.2/include/varnishapi.h 2008-03-08 16:56:55 UTC (rev 2573)
@@ -44,8 +44,8 @@
typedef int vsl_handler(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr);
#define VSL_S_CLIENT (1 << 0)
#define VSL_S_BACKEND (1 << 1)
-#define VSL_ARGS "bCcdI:i:r:X:x:"
-#define VSL_USAGE "[-bCcd] [-i tag] [-I regexp] [-r file] [-X regexp] [-x tag]"
+#define VSL_ARGS "bCcdI:i:r:s:X:x:"
+#define VSL_USAGE "[-bCcd] [-i tag] [-I regexp] [-r file] [-s skip] [-X regexp] [-x tag]"
vsl_handler VSL_H_Print;
struct VSL_data;
struct VSL_data *VSL_New(void);
Modified: branches/1.2/lib/libvarnishapi/shmlog.c
===================================================================
--- branches/1.2/lib/libvarnishapi/shmlog.c 2008-03-08 16:55:22 UTC (rev 2572)
+++ branches/1.2/lib/libvarnishapi/shmlog.c 2008-03-08 16:56:55 UTC (rev 2573)
@@ -85,6 +85,8 @@
int regflags;
regex_t *regincl;
regex_t *regexcl;
+
+ unsigned long skip;
};
#ifndef MAP_HASSEMAPHORE
@@ -289,6 +291,10 @@
default:
break;
}
+ if (vd->skip) {
+ --vd->skip;
+ continue;
+ }
if (vd->map[p[0]] & M_SELECT) {
*pp = p;
return (1);
@@ -472,6 +478,26 @@
/*--------------------------------------------------------------------*/
+static int
+vsl_s_arg(struct VSL_data *vd, const char *opt)
+{
+ char *end;
+
+ CHECK_OBJ_NOTNULL(vd, VSL_MAGIC);
+ if (*opt == '\0') {
+ fprintf(stderr, "number required for -s\n");
+ return (-1);
+ }
+ vd->skip = strtoul(opt, &end, 10);
+ if (*end != '\0') {
+ fprintf(stderr, "invalid number for -s\n");
+ return (-1);
+ }
+ return (1);
+}
+
+/*--------------------------------------------------------------------*/
+
int
VSL_Arg(struct VSL_data *vd, int arg, const char *opt)
{
@@ -485,6 +511,7 @@
case 'r': return (vsl_r_arg(vd, opt));
case 'I': case 'X': return (vsl_IX_arg(vd, opt, arg));
case 'C': vd->regflags = REG_ICASE; return (1);
+ case 's': return (vsl_s_arg(vd, opt));
default:
return (0);
}
More information about the varnish-commit
mailing list