[patch] vt_console_print bug

Andrea Arcangeli (andrea@suse.de)
Fri, 13 Aug 1999 21:03:39 +0200 (CEST)


Redirecting all kernel messages to a fixed terminal (not the foreground
one) caused the kernel messages to be screwed up on such fixed vt.

Here it is my fix against both 2.2.x and 2.3.x:

--- 2.2.11/drivers/char/console.c Wed Mar 24 01:44:52 1999
+++ 2.2.11-cons/drivers/char/console.c Fri Aug 13 20:45:13 1999
@@ -1984,7 +1984,7 @@
static unsigned long printing = 0;
const ushort *start;
ushort cnt = 0;
- ushort myx = x;
+ ushort myx;

/* console busy or not yet initialized */
if (!printable || test_and_set_bit(0, &printing))
@@ -1992,6 +1992,10 @@

if (kmsg_redirect && vc_cons_allocated(kmsg_redirect - 1))
currcons = kmsg_redirect - 1;
+
+ /* read `x' only after setting currecons properly (otherwise
+ the `x' macro will read the x of the foreground console). */
+ myx = x;

if (!vc_cons_allocated(currcons)) {
/* impossible */

The problem was that `x' is a macro that expands to something like
`vc_cons[currcons].d->vc_x' and so we must read x only _after_ setting
currcons to the kmsg_redirect_console.

Andrea

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