[PATCH] Don't put POLLHUP i .events

Tollef Fog Heen tfheen at varnish-software.com
Tue Oct 2 08:41:24 CEST 2012


POLLHUP is always checked for, and is output-only on Linux and OSX, so
avoid putting it in the list of events we check for.
---
 bin/varnishtest/vtc_http.c    |    2 +-
 bin/varnishtest/vtc_varnish.c |   10 +---------
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index 0678efd..4f084ad 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -1043,7 +1043,7 @@ cmd_http_expect_close(CMD_ARGS)
 	vtc_log(vl, 4, "Expecting close (fd = %d)", hp->fd);
 	while (1) {
 		fds[0].fd = hp->fd;
-		fds[0].events = POLLIN | POLLHUP | POLLERR;
+		fds[0].events = POLLIN | POLLERR;
 		fds[0].revents = 0;
 		i = poll(fds, 1, 1000);
 		if (i == 0)
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index 0036720..794080f 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -395,16 +395,8 @@ varnish_launch(struct varnish *v)
 	fd[0].fd = v->cli_fd;
 	fd[0].events = POLLIN;
 	fd[1].fd = v->fds[0];
-	fd[1].events = POLLHUP;
-#ifdef __APPLE__
-	/*
-	 * OSX cannot poll a pipe for POLLHUP only, poll just returns
-	 * zero with no revents.
-	 */
-	i = poll(fd, 1, 10000);
-#else
+	fd[1].events = 0; /* Only care about POLLHUP, which is output-only */
 	i = poll(fd, 2, 10000);
-#endif
 	vtc_log(v->vl, 4, "CLIPOLL %d 0x%x 0x%x",
 	    i, fd[0].revents, fd[1].revents);
 	if (i == 0) {
-- 
1.7.10.4




More information about the varnish-dev mailing list