Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Jun 2009 12:45:20 GMT
From:      Zhao Shuai <zhaoshuai@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 164496 for review
Message-ID:  <200906161245.n5GCjKK6045199@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=164496

Change 164496 by zhaoshuai@zhaoshuai on 2009/06/16 12:44:34

	select/poll() hang up is the right behavior.

Affected files ...

.. //depot/projects/soc2009/fifo/fifo_test/functionality/poll.c#3 edit
.. //depot/projects/soc2009/fifo/fifo_test/functionality/select.c#6 edit

Differences ...

==== //depot/projects/soc2009/fifo/fifo_test/functionality/poll.c#3 (text+ko) ====

@@ -1,7 +1,7 @@
 /*
  * Basic FIFO poll test.
  *
- * 1. poll on read descriptor - The same problem as select.
+ * 1. poll on read descriptor - OK.
  * 2. poll on write descriptor - OK.
  */
 
@@ -41,6 +41,11 @@
 		ret = poll(&pfd, 1, INFTIM);
 		if (ret > 0) {
 			printf("poll returned %d, revents = %d\n", ret, (int)pfd.revents);
+
+			if (pfd.revents & POLLHUP) {
+				printf("peer disconnected\n");
+				return (0);
+			}
 #if TEST_READ
 			if (pfd.revents & POLLRDNORM) {
 				n = read(fd, rbuf, BUF_SIZE);

==== //depot/projects/soc2009/fifo/fifo_test/functionality/select.c#6 (text+ko) ====

@@ -1,10 +1,7 @@
 /*
  * Basic FIFO select test.
  *
- * 1. select on read descriptor - XXX
- *	if writer exits before us, "top" shows that we are busy
- *	consuming CPU rather than sleep.
- *
+ * 1. select on read descriptor - OK
  * 2. select on write descriptor - OK
  */
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906161245.n5GCjKK6045199>