summaryrefslogtreecommitdiff
path: root/drivers/char/n_tty.c
diff options
context:
space:
mode:
authorJoe Peterson <joe@skyrush.com>2008-04-30 11:53:30 +0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 19:29:40 +0400
commit575537b3248ee9b7578a3bb3df33fcdda2bfc4d5 (patch)
tree91a7f0c1afaf55772d2cfa20ecfd52f320a05a5a /drivers/char/n_tty.c
parent47f86834bbd4193139d61d659bebf9ab9d691e37 (diff)
downloadlinux-575537b3248ee9b7578a3bb3df33fcdda2bfc4d5.tar.xz
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: Joe Peterson <joe@skyrush.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Oleg Nesterov <oleg@tv-sign.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/n_tty.c')
-rw-r--r--drivers/char/n_tty.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
index 001d9d875387..e1518e17e09d 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.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) &&
((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);
if (tty->closing) {
@@ -746,13 +746,6 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
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 (c == START_CHAR(tty)) {
start_tty(tty);
@@ -763,6 +756,7 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
return;
}
}
+
if (L_ISIG(tty)) {
int signal;
signal = SIGINT;
@@ -792,6 +786,15 @@ send_signal:
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 (c == ERASE_CHAR(tty) || c == KILL_CHAR(tty) ||
(c == WERASE_CHAR(tty) && L_IEXTEN(tty))) {