diff options
author | dds <dds@FreeBSD.org> | 2004-11-16 17:41:16 +0000 |
---|---|---|
committer | dds <dds@FreeBSD.org> | 2004-11-16 17:41:16 +0000 |
commit | a4e1c49bd13700faba8fff9732a12e9bbc0ef3e7 (patch) | |
tree | a561195eb4d7938691d5905b229d149de43d38d3 | |
parent | da7bfea4672b59cc46304ad9cb28ecfe3dca15e6 (diff) | |
download | FreeBSD-src-a4e1c49bd13700faba8fff9732a12e9bbc0ef3e7.zip FreeBSD-src-a4e1c49bd13700faba8fff9732a12e9bbc0ef3e7.tar.gz |
Improvements and fixes in the 1.241 commit:
- Have TS_ZOMBIE ttys return POLLHUP instead of POLLERR
- Remove unneeded POLLWRNORM (old bug)
- TS_ZOMBIE ttys will set POLLIN and POLLRDNORM
- Do not call selrecord in TS_ZOMBIE ttys
PR: kern/73821
Reviewed by: bde
MFC after: 4 weeks
-rw-r--r-- | sys/kern/tty.c | 15 |
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); } |