From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 16:35:42 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3E64106566B; Sun, 19 Sep 2010 16:35:42 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D3DA08FC0A; Sun, 19 Sep 2010 16:35:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JGZgV1008284; Sun, 19 Sep 2010 16:35:42 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JGZgF3008282; Sun, 19 Sep 2010 16:35:42 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201009191635.o8JGZgF3008282@svn.freebsd.org> From: Ed Schouten Date: Sun, 19 Sep 2010 16:35:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212867 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2010 16:35:43 -0000 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)