Re: [PATCH] (*revised*) Fix IXANY and restart after signal (e.g.ctrl-C) in n_tty line discipline

From: Andrew Morton
Date: Thu Jan 17 2008 - 19:12:22 EST


On Thu, 17 Jan 2008 16:44:33 -0700
Joe Peterson <joe@xxxxxxxxxxx> wrote:

> Here is a revised version of my patch, currently in the -mm kernel as
> "fix-ixany-and-restart-after-signal-eg-ctrl-c-in-n_tty-line-discipline".
> It fixes a couple of issues with ttys in the stopped state. See patch
> below for more details.

What were the "couple of issues"?

> This patch should *replace* the old version of the patch.

I don't like replacements a lot. It forces one to re-review the whole
thing from scratch. Which is why I almost always turn the replacement
into an incremental patch, as below.

> It is
> cleaner, and its behavior better matches that of other Unix platforms.
> It also avoids needless/redundant calls to start_tty() when ctrl-S or
> ctrl-Q are hit.
>

--- a/drivers/char/n_tty.c~fix-ixany-and-restart-after-signal-eg-ctrl-c-in-n_tty-line-discipline-update
+++ a/drivers/char/n_tty.c
@@ -695,14 +695,16 @@ static inline void n_tty_receive_char(st
return;
}

- if (tty->stopped && !tty->flow_stopped && I_IXON(tty) && I_IXANY(tty))
- start_tty(tty);
-
if (I_ISTRIP(tty))
c &= 0x7f;
if (I_IUCLC(tty) && L_IEXTEN(tty))
c=tolower(c);

+ if (tty->stopped && !tty->flow_stopped && I_IXON(tty) &&
+ ((I_IXANY(tty) && c != START_CHAR(tty) && c != STOP_CHAR(tty)) ||
+ c == INTR_CHAR(tty) || c == QUIT_CHAR(tty)))
+ start_tty(tty);
+
if (tty->closing) {
if (I_IXON(tty)) {
if (c == START_CHAR(tty))
@@ -766,8 +768,6 @@ 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
_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/