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
This commit is contained in:
Ed Schouten 2010-09-19 16:35:42 +00:00
parent cbf4dac64f
commit d1817ed7f3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=212867

View File

@ -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)