svn commit: r212867 - head/sys/kern
Ed Schouten
ed at FreeBSD.org
Sun Sep 19 16:35:43 UTC 2010
Author: ed
Date: Sun Sep 19 16:35:42 2010
New Revision: 212867
URL: http://svn.freebsd.org/changeset/base/212867
Log:
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
Modified:
head/sys/kern/tty.c
Modified: head/sys/kern/tty.c
==============================================================================
--- head/sys/kern/tty.c Sun Sep 19 16:15:42 2010 (r212866)
+++ head/sys/kern/tty.c Sun Sep 19 16:35:42 2010 (r212867)
@@ -263,12 +263,14 @@ ttydev_open(struct cdev *dev, int oflags
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
}
/* 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)
More information about the svn-src-head
mailing list