diff -Naur linux.old/arch/um/kernel/reboot.c linux/arch/um/kernel/reboot.c --- linux.old/arch/um/kernel/reboot.c 2004-08-30 16:38:37.000000000 -0400 +++ linux/arch/um/kernel/reboot.c 2004-08-30 16:38:51.000000000 -0400 @@ -38,21 +38,19 @@ void uml_cleanup(void) { - kill_off_processes(); do_uml_exitcalls(); + kill_off_processes(); } void machine_restart(char * __unused) { - do_uml_exitcalls(); - kill_off_processes(); + uml_cleanup(); CHOOSE_MODE(reboot_tt(), reboot_skas()); } void machine_power_off(void) { - do_uml_exitcalls(); - kill_off_processes(); + uml_cleanup(); CHOOSE_MODE(halt_tt(), halt_skas()); } @@ -69,5 +67,7 @@ * --------------------------------------------------------------------------- * Local variables: * c-file-style: "linux" + * indent-tabs-mode: t + * tab-width: 8 * End: */ diff -Naur linux.old/arch/um/kernel/um_arch.c linux/arch/um/kernel/um_arch.c --- linux.old/arch/um/kernel/um_arch.c 2004-08-30 16:28:55.000000000 -0400 +++ linux/arch/um/kernel/um_arch.c 2004-08-30 18:20:53.000000000 -0400 @@ -412,9 +412,43 @@ .priority = 0 }; +static int uml_coreonpanic = 0; + +static int coreonpanic_setup(char *str) { + printf("coreonpanic : Kernel will core on panic.\n"); + uml_coreonpanic = 1; + return(0); +} + +__setup("coreonpanic", coreonpanic_setup); +__uml_help(coreonpanic_setup, +"coreonpanic\n" +" This flag make it so that UML will dump core on a kernel panic or segfault.\n" +" Shell environment restrictions on cores (limit or ulimit) still apply.\n\n" +" Beware that your UML will not reboot with this flag.\n" +); + +static int panic_coreonpanic(struct notifier_block *self, unsigned long unused1, + void *unused2) +{ + if(uml_coreonpanic){ + uml_cleanup(); + block_signals(); + abort(); + } + return(0); /* never get here */ +} + +static struct notifier_block panic_coreonpanic_notifier = { + .notifier_call = panic_coreonpanic, + .next = NULL, + .priority = 1 +}; + void __init setup_arch(char **cmdline_p) { notifier_chain_register(&panic_notifier_list, &panic_exit_notifier); + notifier_chain_register(&panic_notifier_list, &panic_coreonpanic_notifier); paging_init(); strcpy(command_line, saved_command_line); *cmdline_p = command_line; @@ -436,5 +470,7 @@ * --------------------------------------------------------------------------- * Local variables: * c-file-style: "linux" + * indent-tabs-mode: t + * tab-width: 8 * End: */