diff options
author | Alfred Perlstein <alfred@FreeBSD.org> | 2002-01-14 22:03:48 +0000 |
---|---|---|
committer | Alfred Perlstein <alfred@FreeBSD.org> | 2002-01-14 22:03:48 +0000 |
commit | 468485b8d2bbf3017b886170d26dc8e4ad694ef8 (patch) | |
tree | fbe2d61149ddb25f961f4713e1fd423963eea4c7 /sys/kern/uipc_socket.c | |
parent | ff6f79686603f93f4d959fad1fdf1a017b23a7d3 (diff) | |
download | src-468485b8d2bbf3017b886170d26dc8e4ad694ef8.tar.gz src-468485b8d2bbf3017b886170d26dc8e4ad694ef8.zip |
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
Notes
Notes:
svn path=/head/; revision=89376
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r-- | sys/kern/uipc_socket.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 114aae6a9790..d81a97d4c13f 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; } |