Drop obsoleted patch.
[linux-flexiantxendom0-3.2.10.git] / arch / um / kernel / core-on-panic.c
1 /*
2  * allow user mode linux kernels dump core on kernel panics,
3  * for later analysis of the crash.
4  *
5  * (c) 2004 Gerd Knorr + D. Bahi
6  */
7 #include <linux/kernel.h>
8 #include <linux/init.h>
9 #include <linux/notifier.h>
10
11 #include "init.h"
12 #include "os.h"
13
14 static int core_on_panic_func(struct notifier_block *self, unsigned long unused1,
15                               void *unused2)
16 {
17         static int recurse = 0;
18
19         /* cleanup so we have less to cleanup [linux] on the host */
20         /* could panic in uml_cleanup though so we need a check */
21         if (0 == recurse++)
22                 uml_cleanup();
23
24         /* to prevent keyboard from causing terminal to spew during dump */
25         block_signals();
26
27         /* actually dump ... */
28         abort();
29
30         /* not reached */
31         return 0;
32 }
33
34 static struct notifier_block core_on_panic_notifier = {
35         .notifier_call          = core_on_panic_func,
36         .priority               = 1,
37 };
38
39 static int core_on_panic = 0;
40
41 static int __init core_on_panic_setup(char *str)
42 {
43         core_on_panic = 1;
44         return 0;
45 }
46
47 static int __init core_on_panic_init(void)
48 {
49         if (core_on_panic)
50                 notifier_chain_register(&panic_notifier_list, &core_on_panic_notifier);
51         return 0;
52 }
53
54 __initcall(core_on_panic_init);
55 __setup("coreonpanic", core_on_panic_setup);
56 __uml_help(core_on_panic_setup,
57         "coreonpanic\n"
58         "    This flag make it so that UML will dump core on a kernel panic or segfault.\n"
59         "    Shell environment restrictions on cores (limit or ulimit) still apply.\n"
60         "\n"
61         "    Beware that your UML will not reboot with this flag.\n"
62         "\n"
63 );
64