From 3eb2d2ae44edaca32d72752a771f0232008e8b28 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sun, 28 Mar 2010 10:44:33 -0700 Subject: [PATCH] kernel - Add debug.panic sysctl * Add sysctl knob to panic the kernel for debugging purposes. Submitted-by: Venkatesh Srinivas --- sys/ddb/db_sysctl.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/ddb/db_sysctl.c b/sys/ddb/db_sysctl.c index 982210be59..b7f1bbdea0 100644 --- a/sys/ddb/db_sysctl.c +++ b/sys/ddb/db_sysctl.c @@ -73,6 +73,20 @@ sysctl_debug_enter_debugger(SYSCTL_HANDLER_ARGS) return error; } +static int +sysctl_debug_panic(SYSCTL_HANDLER_ARGS) +{ + int err; + int val = 0; + + err = sysctl_handle_int(oidp, &val, sizeof(val), req); + if (val == 1) + panic("sysctl_debug_panic"); + return err; +} + SYSCTL_PROC(_debug, OID_AUTO, enter_debugger, CTLTYPE_STRING | CTLFLAG_RW, 0, 0, sysctl_debug_enter_debugger, "A", DESCRIPTION); +SYSCTL_PROC(_debug, OID_AUTO, panic, CTLTYPE_INT | CTLFLAG_RW, 0, 0, + sysctl_debug_panic, "I", "Set to panic the system"); -- 2.11.4.GIT