Messages in this thread | | | Date | Thu, 23 Dec 2004 12:04:11 +0100 | From | Luca Falavigna <> | Subject | Re: Printk output on console |
| |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi Selvakumar, | While the |> kernel is in execution where the output of all these |> statements will go?
printk messages go to /proc/kmsg. You can read them using cat (e.g. cat /proc/kmsg) | can we redirect the output of |> printk to our console?
There is another way to display kernel messages on a console: managing ttys. Here is some code (taken from Peter Salzman's "The Linux Kernel Module Programming Guide"):
static void print_string(char *str) { struct tty_struct *tty;
#if ( LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,5) ) tty = current->tty; #else tty = current->signal->tty; #endif
if (!tty) return;
((my_tty->driver)->write) (my_tty, 0, str, strlen(str)); ((my_tty->driver)->write) (my_tty, 0, "\015\012", 2);
}
Regards,
Luca -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iQEVAwUBQcqmKxZrwl7j21nOAQKKegf/ZvQxx4FlaObzfeRQYXr5rRyK3/CSwaMX 3vFxX4fGm1Bn0PkTM1NgmgGnDdWaRFyME4odSy6k5XjnyPwO1DqkDUqJarexaq2V 8wrFhQMe3duEhgxonhOSVn/n+/ZIkqxkLujgk5YNpI8jE2vgzw9SwgGb5ck4wEz3 KbqF7YDRPnPot2rud3RTVVzc1MOb0Ti0zDRMpmvyOxkjOL1eocYKJfo5ZalNBQZi k6B7Akk4zWZ6iFjl2Ojxw4RrZVoUupPb2qbkGWp11ghStTur1Qpw5WJyQ25zQB40 8r8ERFfzE02dbE/jiUj5SucJ8DVIKY38KXcMTS64+vWtH9263GkuxQ== =1DIB -----END PGP SIGNATURE-----
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |