summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2002-01-14 22:03:48 +0000
committeralfred <alfred@FreeBSD.org>2002-01-14 22:03:48 +0000
commitc8a759143f8689504efbb41dfca02009a497548e (patch)
treefbe2d61149ddb25f961f4713e1fd423963eea4c7 /sys/kern
parentd5ccc496a64277c6ec707c6dd76aef59342cae27 (diff)
downloadFreeBSD-src-c8a759143f8689504efbb41dfca02009a497548e.zip
FreeBSD-src-c8a759143f8689504efbb41dfca02009a497548e.tar.gz
Fix select on fifos.
Backout revision 1.56 and 1.57 of fifo_vnops.c. Introduce a new poll op "POLLINIGNEOF" that can be used to ignore EOF on a fifo, POLLIN/POLLRDNORM is converted to POLLINIGNEOF within the FIFO implementation to effect the correct behavior. This should allow one to view a fifo pretty much as a data source rather than worry about connections coming and going. Reviewed by: bde
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/uipc_socket.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 114aae6..d81a97d 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1538,6 +1538,11 @@ sopoll(struct socket *so, int events, struct ucred *cred, struct thread *td)
if (soreadable(so))
revents |= events & (POLLIN | POLLRDNORM);
+ if (events & POLLINIGNEOF)
+ if (so->so_rcv.sb_cc >= so->so_rcv.sb_lowat ||
+ !TAILQ_EMPTY(&so->so_comp) || so->so_error)
+ revents |= POLLINIGNEOF;
+
if (events & (POLLOUT | POLLWRNORM))
if (sowriteable(so))
revents |= events & (POLLOUT | POLLWRNORM);
@@ -1547,7 +1552,9 @@ sopoll(struct socket *so, int events, struct ucred *cred, struct thread *td)
revents |= events & (POLLPRI | POLLRDBAND);
if (revents == 0) {
- if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) {
+ if (events &
+ (POLLIN | POLLINIGNEOF | POLLPRI | POLLRDNORM |
+ POLLRDBAND)) {
selrecord(td, &so->so_rcv.sb_sel);
so->so_rcv.sb_flags |= SB_SEL;
}
OpenPOWER on IntegriCloud