Mailing List Archive

r2296 - in branches/1.1: . bin/varnishlog bin/varnishncsa
Author: des
Date: 2007-12-18 17:13:36 +0100 (Tue, 18 Dec 2007)
New Revision: 2296

Modified:
branches/1.1/
branches/1.1/bin/varnishlog/varnishlog.c
branches/1.1/bin/varnishncsa/varnishncsa.c
Log:
Merged revisions 2270-2271 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).
........



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,2211-2212,2215-2220,2222-2232,2243
+ /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,2211-2212,2215-2220,2222-2232,2243,2270-2271

Modified: branches/1.1/bin/varnishlog/varnishlog.c
===================================================================
--- branches/1.1/bin/varnishlog/varnishlog.c 2007-12-18 06:58:33 UTC (rev 2295)
+++ branches/1.1/bin/varnishlog/varnishlog.c 2007-12-18 16:13:36 UTC (rev 2296)
@@ -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;
@@ -358,12 +358,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.1/bin/varnishncsa/varnishncsa.c
===================================================================
--- branches/1.1/bin/varnishncsa/varnishncsa.c 2007-12-18 06:58:33 UTC (rev 2295)
+++ branches/1.1/bin/varnishncsa/varnishncsa.c 2007-12-18 16:13:36 UTC (rev 2296)
@@ -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 */
@@ -187,7 +189,7 @@
end = ptr + len;

if (!(spec & VSL_S_CLIENT || spec & VSL_S_BACKEND))
- return (0);
+ return (reopen);

if (fd >= nll) {
struct logline **newll = ll;
@@ -315,11 +317,11 @@
}

if ((spec & VSL_S_CLIENT) && tag != SLT_ReqEnd)
- return (0);
+ return (reopen);

if ((spec & VSL_S_BACKEND) && tag != SLT_BackendReuse &&
(tag != SLT_BackendClose || lp->df_Uq))
- return (0);
+ return (reopen);

if (tag == SLT_ReqEnd) {
if (sscanf(ptr, "%*u %*u.%*u %ld.", &l) != 1)
@@ -407,13 +409,11 @@
#undef freez
lp->bogus = 0;

- return (0);
+ return (reopen);
}

/*--------------------------------------------------------------------*/

-static volatile sig_atomic_t reopen;
-
static void
sighup(int sig)
{
@@ -447,7 +447,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 +459,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 +511,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);