/* gcc -c -o panic.o panic.c -DMODULE -D__KERNEL__ -Ikernel-include-path */ #include #include #include #include #include #include static int type=0; static char message[1024] = "Synthetic panic"; static int __init panic_init(void) { if (type == 0) BUG(); else if (type == 1) panic(message); return -EAGAIN; } module_init(panic_init); EXPORT_NO_SYMBOLS; MODULE_AUTHOR("Ben Winslow"); MODULE_LICENSE("Dual BSD/GPL"); MODULE_DESCRIPTION("Panics the kernel!"); MODULE_PARM(type, "i"); MODULE_PARM_DESC(type, "Type of panic: 0=BUG(), 1=panic()"); MODULE_PARM(message, "c1024"); MODULE_PARM_DESC(message, "panic() message (default: \"Synthetic panic\")");