summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/tty.c')
-rw-r--r--sys/kern/tty.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index 0793e1f..d359f8d 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -1283,20 +1283,23 @@ ttypoll(struct cdev *dev, int events, struct thread *td)
s = spltty();
if (events & (POLLIN | POLLRDNORM)) {
- if (ttnread(tp) > 0)
+ if (ISSET(tp->t_state, TS_ZOMBIE))
+ revents |= (events & (POLLIN | POLLRDNORM)) |
+ POLLHUP;
+ else if (ttnread(tp) > 0)
revents |= events & (POLLIN | POLLRDNORM);
else
selrecord(td, &tp->t_rsel);
}
- if (events & (POLLOUT | POLLWRNORM)) {
- if (tp->t_outq.c_cc <= tp->t_olowat &&
+ if (events & POLLOUT) {
+ if (ISSET(tp->t_state, TS_ZOMBIE))
+ revents |= POLLHUP;
+ else if (tp->t_outq.c_cc <= tp->t_olowat &&
ISSET(tp->t_state, TS_CONNECTED))
- revents |= events & (POLLOUT | POLLWRNORM);
+ revents |= events & POLLOUT;
else
selrecord(td, &tp->t_wsel);
}
- if (ISSET(tp->t_state, TS_ZOMBIE))
- revents |= POLLERR;
splx(s);
return (revents);
}
OpenPOWER on IntegriCloud