aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/socketvar.h
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2009-07-07 09:43:44 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2009-07-07 09:43:44 +0000
commit7f5dff50646e2eb5e7cf490c0a73f49f85ab5ce1 (patch)
treefa963c164b557f57ea4c0183ad1527b57d286d89 /sys/sys/socketvar.h
parent55b57bd2746a468fdc3de857b95d4037c5cda593 (diff)
downloadsrc-7f5dff50646e2eb5e7cf490c0a73f49f85ab5ce1.tar.gz
src-7f5dff50646e2eb5e7cf490c0a73f49f85ab5ce1.zip
Fix poll(2) and select(2) for named pipes to return "ready for read"
when all writers, observed by reader, exited. Use writer generation counter for fifo, and store the snapshot of the fifo generation in the f_seqcount field of struct file, that is otherwise unused for fifos. Set FreeBSD-undocumented POLLINIGNEOF flag only when file f_seqcount is equal to fifo' fi_wgen, and revert r89376. Fix POLLINIGNEOF for sockets and pipes, and return POLLHUP for them. Note that the patch does not fix not returning POLLHUP for fifos. PR: kern/94772 Submitted by: bde (original version) Reviewed by: rwatson, jilles Approved by: re (kensmith) MFC after: 6 weeks (might be)
Notes
Notes: svn path=/head/; revision=195423
Diffstat (limited to 'sys/sys/socketvar.h')
-rw-r--r--sys/sys/socketvar.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h
index 2817b84fa29b..889908315d25 100644
--- a/sys/sys/socketvar.h
+++ b/sys/sys/socketvar.h
@@ -197,10 +197,11 @@ struct xsocket {
((so)->so_proto->pr_flags & PR_ATOMIC)
/* can we read something from so? */
-#define soreadable(so) \
+#define soreadabledata(so) \
((so)->so_rcv.sb_cc >= (so)->so_rcv.sb_lowat || \
- ((so)->so_rcv.sb_state & SBS_CANTRCVMORE) || \
!TAILQ_EMPTY(&(so)->so_comp) || (so)->so_error)
+#define soreadable(so) \
+ (soreadabledata(so) || ((so)->so_rcv.sb_state & SBS_CANTRCVMORE))
/* can we write something to so? */
#define sowriteable(so) \