summaryrefslogtreecommitdiffstats
path: root/sys/fs/fifofs/fifo_vnops.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2009-08-25 21:44:14 +0000
committerjilles <jilles@FreeBSD.org>2009-08-25 21:44:14 +0000
commit0b9c3c2f3dba778ac524d7fac5931cf44d5f97fe (patch)
tree2ccf45e2050ec4c93f8467202055c0084e85bbdc /sys/fs/fifofs/fifo_vnops.c
parentcd97215dd65e5058b5bd29ccae52218ae46695bc (diff)
downloadFreeBSD-src-0b9c3c2f3dba778ac524d7fac5931cf44d5f97fe.zip
FreeBSD-src-0b9c3c2f3dba778ac524d7fac5931cf44d5f97fe.tar.gz
Fix poll() on half-closed sockets, while retaining POLLHUP for fifos.
This reverts part of r196460, so that sockets only return POLLHUP if both directions are closed/error. Fifos get POLLHUP by closing the unused direction immediately after creating the sockets. The tools/regression/poll/*poll.c tests now pass except for two other things: - if POLLHUP is returned, POLLIN is always returned as well instead of only when there is data left in the buffer to be read - fifo old/new reader distinction does not work the way POSIX specs it Reviewed by: kib, bde
Diffstat (limited to 'sys/fs/fifofs/fifo_vnops.c')
-rw-r--r--sys/fs/fifofs/fifo_vnops.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c
index 25436c7..5668f75 100644
--- a/sys/fs/fifofs/fifo_vnops.c
+++ b/sys/fs/fifofs/fifo_vnops.c
@@ -193,6 +193,9 @@ fifo_open(ap)
goto fail2;
fip->fi_writesock = wso;
error = soconnect2(wso, rso);
+ /* Close the direction we do not use, so we can get POLLHUP. */
+ if (error == 0)
+ error = soshutdown(rso, SHUT_WR);
if (error) {
(void)soclose(wso);
fail2:
OpenPOWER on IntegriCloud