From owner-freebsd-stable@FreeBSD.ORG Tue Dec 17 21:18:28 2013 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2C5EDC00 for ; Tue, 17 Dec 2013 21:18:28 +0000 (UTC) Received: from nmsh3.e.nsc.no (nmsh3.e.nsc.no [193.213.121.74]) by mx1.freebsd.org (Postfix) with ESMTP id 8D98A1DC7 for ; Tue, 17 Dec 2013 21:18:26 +0000 (UTC) Received: from terraplane.org (ti0027a380-0148.bb.online.no [88.89.180.148]) by nmsh3.nsc.no (8.14.4/8.14.4) with ESMTP id rBHLIHKx027031 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Tue, 17 Dec 2013 22:18:18 +0100 (MET) Received: from terraplane.org (localhost [127.0.0.1]) by terraplane.org (8.14.5/8.14.5) with ESMTP id rBHLIG6M042381 for ; Tue, 17 Dec 2013 22:18:17 +0100 (CET) (envelope-from rumrunner@terraplane.org) Received: (from rumrunner@localhost) by terraplane.org (8.14.5/8.13.8/Submit) id rBHLIGVQ042380 for freebsd-stable@freebsd.org; Tue, 17 Dec 2013 22:18:16 +0100 (CET) (envelope-from rumrunner) Date: Tue, 17 Dec 2013 22:18:16 +0100 From: Eivind Evensen To: freebsd-stable@freebsd.org Subject: Support DISCARD (^O) Message-ID: <20131217211816.GA41797@klump.hjerdalen.lokalnett> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Dec 2013 21:18:28 -0000 Hello. I don't know if there is any particular reason that support for DISCARD/^O was not included in the tty rewrite that happened from FreeBSD 7 to 8, but in case anybody else wants it, here's a diff functioning mostly like in 7, except output isn't switched back on automatically on input. Diff is against FreeBSD 8, however, last time I checked I didn't see much difference in the newer versions. Regards, Eivind diff -r 91820d9948e0 -r 13f40d577646 sys/kern/tty_ttydisc.c --- a/sys/kern/tty_ttydisc.c Fri Feb 22 09:45:32 2013 +0100 +++ b/sys/kern/tty_ttydisc.c Tue Dec 17 23:03:17 2013 +0100 @@ -448,6 +448,9 @@ if (tp->t_flags & TF_ZOMBIE) return (EIO); + if (tp->t_termios.c_lflag & FLUSHO) + return (0); + /* * We don't need to check whether the process is the foreground * process group or if we have a carrier. This is already done @@ -881,6 +884,14 @@ /* Special control characters that are implementation dependent. */ if (CMP_FLAG(l, IEXTEN)) { + /* Discard (^O) */ + if (CMP_CC(VDISCARD, c)) { + if (!(tp->t_termios.c_lflag & FLUSHO)) + ttyoutq_write_nofrag(&tp->t_outq, "^O", 2); + tp->t_termios.c_lflag ^= FLUSHO; + return(0); + } + /* Accept the next character as literal. */ if (CMP_CC(VLNEXT, c)) { if (CMP_FLAG(l, ECHO)) {