提交 575537b3 编写于 作者: J Joe Peterson 提交者: Linus Torvalds

Resume TTY on SUSP and fix CRNL order in N_TTY line discipline

Refine these behaviors in the N_TTY line discipline:

1) Handle the signal characters consistently when received in a stopped TTY
   so that SUSP (typically ctrl-Z) behaves like INTR and QUIT in resuming a
   stopped TTY.

2) Adjust the order in which the IGNCR/ICRNL/INLCR processing is applied to
   be more logical and consistent with the behavior of other Unix systems.
Signed-off-by: NJoe Peterson <joe@skyrush.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 47f86834
...@@ -708,7 +708,7 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c) ...@@ -708,7 +708,7 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
if (tty->stopped && !tty->flow_stopped && I_IXON(tty) && if (tty->stopped && !tty->flow_stopped && I_IXON(tty) &&
((I_IXANY(tty) && c != START_CHAR(tty) && c != STOP_CHAR(tty)) || ((I_IXANY(tty) && c != START_CHAR(tty) && c != STOP_CHAR(tty)) ||
c == INTR_CHAR(tty) || c == QUIT_CHAR(tty))) c == INTR_CHAR(tty) || c == QUIT_CHAR(tty) || c == SUSP_CHAR(tty)))
start_tty(tty); start_tty(tty);
if (tty->closing) { if (tty->closing) {
...@@ -746,13 +746,6 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c) ...@@ -746,13 +746,6 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
return; return;
} }
if (c == '\r') {
if (I_IGNCR(tty))
return;
if (I_ICRNL(tty))
c = '\n';
} else if (c == '\n' && I_INLCR(tty))
c = '\r';
if (I_IXON(tty)) { if (I_IXON(tty)) {
if (c == START_CHAR(tty)) { if (c == START_CHAR(tty)) {
start_tty(tty); start_tty(tty);
...@@ -763,6 +756,7 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c) ...@@ -763,6 +756,7 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
return; return;
} }
} }
if (L_ISIG(tty)) { if (L_ISIG(tty)) {
int signal; int signal;
signal = SIGINT; signal = SIGINT;
...@@ -792,6 +786,15 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c) ...@@ -792,6 +786,15 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
return; return;
} }
} }
if (c == '\r') {
if (I_IGNCR(tty))
return;
if (I_ICRNL(tty))
c = '\n';
} else if (c == '\n' && I_INLCR(tty))
c = '\r';
if (tty->icanon) { if (tty->icanon) {
if (c == ERASE_CHAR(tty) || c == KILL_CHAR(tty) || if (c == ERASE_CHAR(tty) || c == KILL_CHAR(tty) ||
(c == WERASE_CHAR(tty) && L_IEXTEN(tty))) { (c == WERASE_CHAR(tty) && L_IEXTEN(tty))) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册