[PATCH] Fix trivial unwind info bug
[linux-2.6/verdex.git] / arch / um / drivers / stderr_console.c
blob6d2cf32a9e8f880eeaf7439e874ef4640f3ec7dc
1 #include <linux/init.h>
2 #include <linux/console.h>
4 #include "chan_user.h"
6 /* ----------------------------------------------------------------------------- */
7 /* trivial console driver -- simply dump everything to stderr */
9 /*
10 * Don't register by default -- as this registeres very early in the
11 * boot process it becomes the default console.
13 static int use_stderr_console = 0;
15 static void stderr_console_write(struct console *console, const char *string,
16 unsigned len)
18 generic_write(2 /* stderr */, string, len, NULL);
21 static struct console stderr_console = {
22 .name = "stderr",
23 .write = stderr_console_write,
24 .flags = CON_PRINTBUFFER,
27 static int __init stderr_console_init(void)
29 if (use_stderr_console)
30 register_console(&stderr_console);
31 return 0;
33 console_initcall(stderr_console_init);
35 static int stderr_setup(char *str)
37 if (!str)
38 return 0;
39 use_stderr_console = simple_strtoul(str,&str,0);
40 return 1;
42 __setup("stderr=", stderr_setup);
44 /* The previous behavior of not unregistering led to /dev/console being
45 * impossible to open. My FC5 filesystem started having init die, and the
46 * system panicing because of this. Unregistering causes the real
47 * console to become the default console, and /dev/console can then be
48 * opened. Making this an initcall makes this happen late enough that
49 * there is no added value in dumping everything to stderr, and the
50 * normal console is good enough to show you all available output.
52 static int __init unregister_stderr(void)
54 unregister_console(&stderr_console);
56 return 0;
59 __initcall(unregister_stderr);