2007-12-06 19:22:14

by Joe Peterson

[permalink] [raw]
Subject: [PATCH] Enabling the echo of ctrl-C (and the like)

--- linux-2.6.22-gentoo-r9/drivers/char/n_tty.c 2007-07-08 17:32:17.000000000 -0600
+++ linux-2.6.22-gentoo-r9.new/drivers/char/n_tty.c 2007-12-06 07:16:56.000000000 -0700
@@ -760,7 +760,22 @@
signal = SIGTSTP;
if (c == SUSP_CHAR(tty)) {
send_signal:
- isig(signal, tty, 0);
+ /*
+ * 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);
+ if (tty->driver->flush_buffer)
+ tty->driver->flush_buffer(tty);
+ }
+ if (L_ECHO(tty)) {
+ echo_char(c, tty);
+ }
+ if (tty->pgrp)
+ kill_pgrp(tty->pgrp, signal, 1);
return;
}
}


Attachments:
echo-ctrl-c.patch (734.00 B)

2007-12-06 19:36:33

by Alan Cox

[permalink] [raw]
Subject: Re: [PATCH] Enabling the echo of ctrl-C (and the like)

On Thu, Dec 06, 2007 at 12:21:55PM -0700, Joe Peterson wrote:
> I've used over the years as well. Bringing this to Linux also seems
> like a good way to make it yet more compliant with standard unix-like
> behavior.
>
> The fix is pretty trivial. Let me know if you think this is a candidate
> for inclusion in the kernel.

If it matches other platforms and doesn't seem to break anything then I
don't see a problem.