Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Sep 2010 16:35:42 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r212867 - head/sys/kern
Message-ID:  <201009191635.o8JGZgF3008282@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009191635.o8JGZgF3008282>