Commit 9d49ccba authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Polish the debugstunt and make it possible to avoid it.


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@672 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent d581dcb1
......@@ -267,22 +267,31 @@ DebugStunt(void)
assert(j == i);
while (1) {
if (pfd[0].fd == -1 && pfd[1].fd == -1)
break;
i = poll(pfd, 2, INFTIM);
for (k = 0; k < 2; k++) {
if (pfd[k].revents == 0)
continue;
if (pfd[k].revents != POLLIN)
exit (2);
if (pfd[k].revents != POLLIN) {
printf("k %d rev %d\n", k, pfd[k].revents);
pfd[k].fd = -1;
}
j = read(pipes[k][0], buf, sizeof buf);
if (j == 0)
exit (0);
if (j == 0) {
printf("k %d eof\n", k);
pfd[k].fd = -1;
}
if (j > 0) {
i = write(pipes[k][1], buf, j);
if (i != j)
err(1, "i = %d j = %d\n", i, j);
if (i != j) {
printf("k %d write (%d %d)\n", k, i, j);
pfd[k].fd = -1;
}
}
}
}
exit (0);
}
......@@ -380,7 +389,7 @@ main(int argc, char *argv[])
VSL_MgtInit(SHMLOG_FILENAME, 8*1024*1024);
if (dflag)
if (dflag == 1)
DebugStunt();
daemon(dflag, dflag);
if (dflag)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment