summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty.c
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2010-09-19 16:35:42 +0000
committered <ed@FreeBSD.org>2010-09-19 16:35:42 +0000
commita67dfa17fa374c90926bad24ba3ce7cb6e727e80 (patch)
treec1cc15e55a4103dc9f64f7f8814a3a7a3156ea73 /sys/kern/tty.c
parent9673f78b29dbcfcf67a2a68cb4ca94519e57a417 (diff)
downloadFreeBSD-src-a67dfa17fa374c90926bad24ba3ce7cb6e727e80.zip
FreeBSD-src-a67dfa17fa374c90926bad24ba3ce7cb6e727e80.tar.gz
Just make callout devices and /dev/console force CLOCAL on open().
Instead of adding custom checks to wait for DCD on open(), just modify the termios structure to set CLOCAL. This means SIGHUP is no longer generated when losing DCD as well. Reviewed by: kib@ MFC after: 1 week
Diffstat (limited to 'sys/kern/tty.c')
-rw-r--r--sys/kern/tty.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index ed22e7a..05eb27d 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -263,12 +263,14 @@ ttydev_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
if (!tty_opened(tp)) {
/* Set proper termios flags. */
- if (TTY_CALLOUT(tp, dev)) {
+ if (TTY_CALLOUT(tp, dev))
tp->t_termios = tp->t_termios_init_out;
- } else {
+ else
tp->t_termios = tp->t_termios_init_in;
- }
ttydevsw_param(tp, &tp->t_termios);
+ /* Prevent modem control on callout devices and /dev/console. */
+ if (TTY_CALLOUT(tp, dev) || dev == dev_console)
+ tp->t_termios.c_cflag |= CLOCAL;
ttydevsw_modem(tp, SER_DTR|SER_RTS, 0);
@@ -281,9 +283,8 @@ ttydev_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
}
/* Wait for Carrier Detect. */
- if (!TTY_CALLOUT(tp, dev) && (oflags & O_NONBLOCK) == 0 &&
- (tp->t_termios.c_cflag & CLOCAL) == 0 &&
- dev != dev_console) {
+ if ((oflags & O_NONBLOCK) == 0 &&
+ (tp->t_termios.c_cflag & CLOCAL) == 0) {
while ((ttydevsw_modem(tp, 0, 0) & SER_DCD) == 0) {
error = tty_wait(tp, &tp->t_dcdwait);
if (error != 0)
OpenPOWER on IntegriCloud