From 010f86dc1259be3b29303bfc336532138acd077d Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Sat, 24 Sep 2011 22:16:13 +0800 Subject: [PATCH] fifo: Restore the old semantics of select(2)/poll(2) for reading select(2)/poll(2) for reading on a fifo should not return "ready to read" if all of the writers have closed the fifo. DragonFly-Bug: http://bugs.dragonflybsd.org/issue2028 --- sys/vfs/fifofs/fifo_vnops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/vfs/fifofs/fifo_vnops.c b/sys/vfs/fifofs/fifo_vnops.c index 22e2a5a4aa..a2d63411cd 100644 --- a/sys/vfs/fifofs/fifo_vnops.c +++ b/sys/vfs/fifofs/fifo_vnops.c @@ -422,7 +422,8 @@ filt_fiforead(struct knote *kn, long hint) lwkt_gettoken(&vp->v_token); kn->kn_data = so->so_rcv.ssb_cc; - if (so->so_state & SS_ISDISCONNECTED) { + if ((kn->kn_sfflags & NOTE_OLDAPI) == 0 && + so->so_state & SS_ISDISCONNECTED) { if (kn->kn_data == 0) kn->kn_flags |= EV_NODATA; kn->kn_flags |= EV_EOF; -- 2.41.0