Commit 3dddc75c authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

More work on the debug stunt


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@676 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 9a93399c
......@@ -271,21 +271,31 @@ DebugStunt(void)
break;
i = poll(pfd, 2, INFTIM);
for (k = 0; k < 2; k++) {
if (pfd[k].fd == -1)
continue;
if (pfd[k].revents == 0)
continue;
if (pfd[k].revents != POLLIN) {
printf("k %d rev %d\n", k, pfd[k].revents);
AZ(close(pipes[k][0]));
AZ(close(pipes[k][1]));
pfd[k].fd = -1;
if (k == 1)
exit (0);
}
j = read(pipes[k][0], buf, sizeof buf);
if (j == 0) {
printf("k %d eof\n", k);
AZ(close(pipes[k][0]));
AZ(close(pipes[k][1]));
pfd[k].fd = -1;
}
if (j > 0) {
i = write(pipes[k][1], buf, j);
if (i != j) {
printf("k %d write (%d %d)\n", k, i, j);
AZ(close(pipes[k][0]));
AZ(close(pipes[k][1]));
pfd[k].fd = -1;
}
}
......@@ -391,7 +401,8 @@ main(int argc, char *argv[])
if (dflag == 1)
DebugStunt();
daemon(dflag, dflag);
if (dflag != 2)
daemon(dflag, dflag);
if (dflag)
printf("%d\n%d\n%d\n", getpid(), getsid(0), getpgrp());
......
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