diff options
author | ed <ed@FreeBSD.org> | 2009-06-12 20:29:55 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-06-12 20:29:55 +0000 |
commit | 0e4ff69bbaf0a890087aaa913e3afc146145e5d5 (patch) | |
tree | 354a7f3c65fdf1795e12377bdc382045977c2cbb | |
parent | 9d4e4b79d95a7b4decd7373927c0ef8bbb2750d0 (diff) | |
download | FreeBSD-src-0e4ff69bbaf0a890087aaa913e3afc146145e5d5.zip FreeBSD-src-0e4ff69bbaf0a890087aaa913e3afc146145e5d5.tar.gz |
Prevent yet another staircase effect bug in the console device.
Even though I thought I fixed the staircase issue (and I was no longer
able to reproduce it), I got some reports of the issue still being
there. It turns out the staircase effect still occurred when
/dev/console was kept open while killing the getty on the same TTY
(ttyv0).
For some reason I can't figure out how the old TTY code dealt with that,
so I assume the issue has always been there. I only exposed it more by
merging consolectl with ttyv0, which means that the issue was present,
even on systems without a serial console.
I'm now marking the console device as being closed when closing the
regular TTY device node. This means that when the getty shuts down,
init(8) will open /dev/console, which means the termios attributes will
always be reset in this case.
-rw-r--r-- | sys/kern/tty.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 162ae37..4a0905a 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -322,14 +322,14 @@ ttydev_close(struct cdev *dev, int fflag, int devtype, struct thread *td) * console. */ MPASS((tp->t_flags & TF_OPENED) != TF_OPENED); - if (dev == dev_console) + if (dev == dev_console) { tp->t_flags &= ~TF_OPENED_CONS; - else - tp->t_flags &= ~(TF_OPENED_IN|TF_OPENED_OUT); - - if (tp->t_flags & TF_OPENED) { - tty_unlock(tp); - return (0); + if (tp->t_flags & TF_OPENED) { + tty_unlock(tp); + return (0); + } + } else { + tp->t_flags &= ~TF_OPENED; } /* |