svn commit: r311952 - head/sys/ddb

Bruce Evans brde at optusnet.com.au
Mon Jan 16 02:00:06 UTC 2017


On Sun, 15 Jan 2017, Slawa Olhovchenkov wrote:

> On Sun, Jan 15, 2017 at 01:07:58PM +0800, Julian Elischer wrote:
>
>>
>> the old DEC machines had (from memory) ^O  which dropped all pending
>> output.
>> Not so useful when there is 2MB of network buffers queued up to you,
>> but very useful on
>> and asr-33 teletype.
>
> Now it useful too, on serial console.
> ^O processing be present years ago in FreeBSD, but removed at time of
> tty code rewrite. As I know patch for restore exist, nobody
> review/commit.

Urk.  I have fixes for hundreds of things broken in the rewrite, but didn't
notice this one.  The only fix I have near here is a partial one for funky
quoting of control characters according to ECHOK and ECHOKE.  ECHOK is a
POSIX feature and ECHOKE is a BSD feature.  The man page still docoments
the old behaviour.

Grepping for CCEQ (and its renaming to the worse name CMP_FLAG in the
rewrite) shows that the only other control character with lost support
is VDSUSP.

Zgrepping for VDISCARD and VDSUSP in /usr/share/man shows the following
bugs:
- VDISCARD and VDSUSP are listed but not described in any useful way in
   termios(4)
- VDSUSP (and dsusp) is listed but not described in any useful way in
   stty(1)
- VDISCARD (and discard) are not mentioned in stty(1).  However,
   'stty discard c' works, and stty's display of the discard character
   works.  stty's displays exactly the special characters that used to
   work.
- VDISCARD and VDSUSP are otherwise undocumented.
- FLUSHO in termios(4) and flusho in stty(1) are listed and described, but
   their close connection with VDISCARD is not mentioned (except stty says
   "being discarded").  FLUSHO is mostly an internal flag.  In the working
   version, It is normally toggled by VDISCARD but is cleared by other actions.
   It can also be controlled by an ioctl, and stty supports the ioctl.  But
   settings by stty are rarely useful since it is normally cleared by other
   The patch in the PR doesn't handle the other actions right.
   actions which stty can't control.

Partial fixes for ECHOKE and nearby things:

X Index: tty_ttydisc.c
X ===================================================================
X --- tty_ttydisc.c	(revision 312117)
X +++ tty_ttydisc.c	(working copy)
X @@ -798,6 +842,16 @@
X  			}
X  		} else {
X  			/* Don't print spaces. */
X +			/*
X +			 * XXX broken if VERASE is disabled.  Can get here
X +			 * then if ECHO is off and:
X +			 * - for VERASE2 if that is not disabled
X +			 * - for the buggy ECHOK/ECHOKE cases
X +			 * - perhaps in other cases.
X +			 * This routine is too generic.
X +			 *
X +			 * XXX the logic is not just non-printing of spaces.
X +			 */
X  			ttydisc_echo(tp, tp->t_termios.c_cc[VERASE], 0);
X  		}
X  	}
X @@ -993,7 +1049,30 @@
X  			ttydisc_rubchar(tp);
X  			return (0);
X  		} else if (CMP_CC(VKILL, c)) {
X +#if 0
X +			/*
X +			 * XXX broken.  This doesn't even look at ECHOK or
X +			 * ECHOKE (nothing does now), and it doesn't produce
X +			 * the documented behaviour of ECHOK.  ECHOK exists
X +			 * to be a non-erasing version of ECHOKE that uses
X +			 * fewer terminal capabilities.  ECHOPRT is also
X +			 * broken (never even looked at).
X +			 */
X  			while (ttydisc_rubchar(tp) == 0);
X +#else
X +			if (CMP_FLAG(l, ECHOKE)) {
X +				/* XXX too hard to fix. */
X +				while (ttydisc_rubchar(tp) == 0)
X +					;
X +			} else {
X +				ttydisc_echo_force(tp, c, 0);
X +				if (CMP_FLAG(l, ECHOK))
X +					ttydisc_echo_force(tp, '\n', 0);
X +				while (ttyinq_peekchar(&tp->t_inq, &c,
X +				    &quote) == 0)
X +					ttyinq_unputchar(&tp->t_inq);
X +			}
X +#endif
X  			return (0);
X  		} else if (CMP_FLAG(l, IEXTEN)) {
X  			if (CMP_CC(VWERASE, c)) {
X @@ -1021,12 +1100,13 @@
X 
X  parmrk:
X  	if (CMP_FLAG(i, PARMRK)) {
X -		/* Prepend 0xff 0x00 0x.. */
X +		/* Prepend 0xff 0x00. */
X  		ob[2] = c;
X  		ol = 3;
X  		quote = 1;
X  	} else {
X -		ob[0] = c;
X +		/* Kill the character for read().  Keep it in c for echoing. */
X +		ob[0] = '\0';
X  		ol = 1;
X  	}
X

Bruce


More information about the svn-src-all mailing list