All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Peterson <joe@skyrush.com>
To: linux-kernel@vger.kernel.org
Cc: alan@lxorguk.ukuu.org.uk, Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] Fix IXANY and restart after signal (e.g. ctrl-C) in n_tty line discipline
Date: Sat, 22 Dec 2007 07:19:58 -0700	[thread overview]
Message-ID: <476D1D0E.6000302@skyrush.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 363 bytes --]

Here is a patch that fixes a couple of issues with ttys in the stopped
state.  See patch below for more details.

Note that this patch assumes that my previous patch from last month
(called "tty-enable-the-echoing-of-c-in-the-n_tty-discipline.patch" in
the -mm tree) has been applied, since part of this patch is adjacent to
that code.

					Happy holidays!  Joe

[-- Attachment #2: ixany-restart.patch --]
[-- Type: text/plain, Size: 1774 bytes --]

Fix two N_TTY line discipline issues related to resuming a stopped TTY
(typically done with ctrl-S):

1) Fix handling of character that resumes a stopped TTY (with IXANY)

With "stty ixany", the TTY line discipline would lose the first character
after the stop, so typing, for example, "hi^Sthere" resulted in "hihere"
(the 't' would cause the resume after ^S, but it would then be thrown away
rather than processed as an input character).  This was inconsistent with
the behavior of other Unix systems.

2) Fix interrupt signal (e.g. ctrl-C) behavior in stopped TTYs

With "stty -ixany" (often the default), interrupt signals were ignored
in a stopped TTY until the TTY was resumed with the start char (typically
ctrl-Q), which was inconsistent with the behavior of other Unix systems.

Signed-off-by: Joe Peterson <joe@skyrush.com>
---

diff -puN a/drivers/char/n_tty.c~tty-fix-ixany-and-restart-after-signal-in-the-n_tty-discipline a/drivers/char/n_tty.c
--- a/drivers/char/n_tty.c~tty-fix-ixany-and-restart-after-signal-in-the-n_tty-discipline	2007-12-20 11:35:05.000000000 -0700
+++ a/drivers/char/n_tty.c	2007-12-20 11:35:36.000000000 -0700
@@ -695,11 +695,8 @@ static inline void n_tty_receive_char(st
 		return;
 	}
 	
-	if (tty->stopped && !tty->flow_stopped &&
-	    I_IXON(tty) && I_IXANY(tty)) {
+	if (tty->stopped && !tty->flow_stopped && I_IXON(tty) && I_IXANY(tty))
 		start_tty(tty);
-		return;
-	}
 	
 	if (I_ISTRIP(tty))
 		c &= 0x7f;
@@ -769,6 +766,8 @@ static inline void n_tty_receive_char(st
 		signal = SIGTSTP;
 		if (c == SUSP_CHAR(tty)) {
 send_signal:
+			if (tty->stopped && !tty->flow_stopped && I_IXON(tty))
+				start_tty(tty);
 			/*
 			 * Echo character, and then send the signal.
 			 * Note that we do not use isig() here because we want

             reply	other threads:[~2007-12-22 14:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-22 14:19 Joe Peterson [this message]
2008-01-17 23:44 ` [PATCH] (*revised*) Fix IXANY and restart after signal (e.g. ctrl-C) in n_tty line discipline Joe Peterson
2008-01-18  0:11   ` Andrew Morton
2008-01-18  0:38     ` Joe Peterson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=476D1D0E.6000302@skyrush.com \
    --to=joe@skyrush.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.