From nobody@FreeBSD.org  Thu Dec 19 08:49:07 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTPS id 5DC2259E
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 19 Dec 2013 08:49:07 +0000 (UTC)
Received: from oldred.freebsd.org (oldred.freebsd.org [IPv6:2001:1900:2254:206a::50:4])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id 4A48119FE
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 19 Dec 2013 08:49:07 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id rBJ8n6Km019658
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 19 Dec 2013 08:49:06 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id rBJ8n6cY019647;
	Thu, 19 Dec 2013 08:49:06 GMT
	(envelope-from nobody)
Message-Id: <201312190849.rBJ8n6cY019647@oldred.freebsd.org>
Date: Thu, 19 Dec 2013 08:49:06 GMT
From: Eivind Nicolay Evensen <eivinde@terraplane.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Missing support for tty DISCARD/^O
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         184987
>Category:       kern
>Synopsis:       Missing support for tty DISCARD/^O
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 19 08:50:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Eivind Nicolay Evensen
>Release:        8
>Organization:
>Environment:
Multiple
>Description:
In the tty rewrite going from 7 to 8 it seems that support for
DISCARD/^O was either dropped or forgotten.

Here's a diff that gives most of the old functionality,
except output is not automatically turned back on upon input.
>How-To-Repeat:
Have something generate output, ^O doesn't discard the output.
>Fix:


Patch attached with submission follows:

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


>Release-Note:
>Audit-Trail:
>Unformatted:
