summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-10-14 18:30:24 +0000
committerphk <phk@FreeBSD.org>2004-10-14 18:30:24 +0000
commitf2eeaa890f83fbc054dcc47aeb2b77ad76fc030a (patch)
treea077bd1c87c3c9280181718537d40c497a1df96d /sys/kern/tty.c
parent846d39b0ea42519bd3866486f47870c790963682 (diff)
downloadFreeBSD-src-f2eeaa890f83fbc054dcc47aeb2b77ad76fc030a.zip
FreeBSD-src-f2eeaa890f83fbc054dcc47aeb2b77ad76fc030a.tar.gz
Add missing chunk of code to enforce the lock-bits of termios.
This solves the problem where serial consoles suddenly required DCD to be asserted. Reported by: Randy Bush <randy@psg.com>
Diffstat (limited to 'sys/kern/tty.c')
-rw-r--r--sys/kern/tty.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index 5dbd358..f81b75a 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -2059,7 +2059,7 @@ loop:
goto out;
}
error = ttysleep(tp, TSA_CARR_ON(tp), TTIPRI | PCATCH,
- "ttydcd", 0);
+ "ttywdcd", 0);
splx(s);
if (error)
goto out;
@@ -3126,6 +3126,7 @@ open_top:
* callout, and to complete a callin open after DCD rises.
*/
tp->t_termios = ISCALLOUT(dev) ? tp->t_init_out : tp->t_init_in;
+ tp->t_cflag = tp->t_termios.c_cflag;
tp->t_modem(tp, SER_DTR | SER_RTS, 0);
++tp->t_wopeners;
error = tp->t_param(tp, &tp->t_termios);
@@ -3209,6 +3210,30 @@ ttyioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td
int error;
tp = dev->si_tty;
+
+ if (cmd == TIOCSETA || cmd == TIOCSETAW || cmd == TIOCSETAF) {
+ int cc;
+ struct termios *dt = (struct termios *)data;
+ struct termios *lt =
+ ISCALLOUT(dev) ? &tp->t_lock_out : &tp->t_lock_in;
+
+ dt->c_iflag = (tp->t_iflag & lt->c_iflag)
+ | (dt->c_iflag & ~lt->c_iflag);
+ dt->c_oflag = (tp->t_oflag & lt->c_oflag)
+ | (dt->c_oflag & ~lt->c_oflag);
+ dt->c_cflag = (tp->t_cflag & lt->c_cflag)
+ | (dt->c_cflag & ~lt->c_cflag);
+ dt->c_lflag = (tp->t_lflag & lt->c_lflag)
+ | (dt->c_lflag & ~lt->c_lflag);
+ for (cc = 0; cc < NCCS; ++cc)
+ if (lt->c_cc[cc] != 0)
+ dt->c_cc[cc] = tp->t_cc[cc];
+ if (lt->c_ispeed != 0)
+ dt->c_ispeed = tp->t_ispeed;
+ if (lt->c_ospeed != 0)
+ dt->c_ospeed = tp->t_ospeed;
+ }
+
error = ttyld_ioctl(tp, cmd, data, flag, td);
if (error == ENOIOCTL)
error = ttioctl(tp, cmd, data, flag);
OpenPOWER on IntegriCloud