Re: Ctrl+C doesn't interrupt process waiting for I/O

From: Joe Peterson
Date: Tue Jul 01 2008 - 12:28:50 EST


Elias Oltmanns wrote:
> Due to my tests, 2.6.24 responds much faster to Ctrl+C than 2.6.25 does.
> The patch above makes them *feel* alike again (no hard numbers, mind).
> However, I haven't checked anything as early as 2.6.21 or before so I
> don't know whether there may have been another regression since then.

OK, thanks for checking. Can you try the patch below? It is almost the
same as your patch, except it reverses the order of the isig and the echo.

This causes ^C echo to work for me in both console and xterm. Back when
I did the original patch, I was concerned this ordering could result in
the ^C echoing late, but this may not be an issue.

Let me know if the patch below fixes the issue with interrupting
processes waiting for I/O.

Thanks, Joe
--- linux/drivers/char/n_tty.c.orig 2008-07-01 10:48:05.000000000 -0500
+++ linux/drivers/char/n_tty.c 2008-07-01 11:20:07.000000000 -0500
@@ -759,20 +759,9 @@
signal = SIGTSTP;
if (c == SUSP_CHAR(tty)) {
send_signal:
- /*
- * Echo character, and then send the signal.
- * Note that we do not use isig() here because we want
- * the order to be:
- * 1) flush, 2) echo, 3) signal
- */
- if (!L_NOFLSH(tty)) {
- n_tty_flush_buffer(tty);
- tty_driver_flush_buffer(tty);
- }
+ isig(signal, tty, 0);
if (L_ECHO(tty))
echo_char(c, tty);
- if (tty->pgrp)
- kill_pgrp(tty->pgrp, signal, 1);
return;
}
}