Date: Mon, 21 May 2001 12:30:44 -0400 From: Jon Parise <jon@csh.rit.edu> To: freebsd-hackers@freebsd.org Subject: sysctl to disable reboot Message-ID: <20010521123044.H29180@csh.rit.edu>
next in thread | raw e-mail | index | archive | help
--EVF5PPMfhYS0aIcm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I thought it would be useful to have a sysctl for disabling the keyboard reboot sequence. This functionality is currently available through the SC_DISABLE_REBOOT config option, but it's convenient to have this capability available at runtime, too. I can't say I'm much of a kernel hacker, but the attached patch works fine for me. It applies against 4.3-STABLE, but the same logic applied to 5.0-CURRENT (which I don't have available for testing). Note that investigation revealed that OpenBSD has a similar sysctl named machdep.kdbreset. I prefer machdep.disable_reboot_key, but I'm against changing it for feel-good compatibility reasons. If someone with clue feels there is merit in this, feel free to commit it. -- Jon Parise (jon@csh.rit.edu) . Rochester Inst. of Technology http://www.csh.rit.edu/~jon/ : Computer Science House Member --EVF5PPMfhYS0aIcm Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="disable_reboot.patch" --- syscons.c.orig Sun Oct 29 11:59:27 2000 +++ syscons.c Mon May 21 12:15:57 2001 @@ -118,6 +118,12 @@ SYSCTL_INT(_machdep, OID_AUTO, enable_panic_key, CTLFLAG_RW, &enable_panic_key, 0, ""); +#ifndef SC_DISABLE_REBOOT +static int disable_reboot_key; +SYSCTL_INT(_machdep, OID_AUTO, disable_reboot_key, CTLFLAG_RW, + &disable_reboot_key, 0, "Disable the reboot key sequence"); +#endif + #define SC_CONSOLECTL 255 #define VIRTUAL_TTY(sc, x) (SC_DEV((sc), (x))->si_tty) @@ -3101,19 +3107,22 @@ case RBT: #ifndef SC_DISABLE_REBOOT - shutdown_nice(0); + if (!disable_reboot_key) + shutdown_nice(0); #endif break; case HALT: #ifndef SC_DISABLE_REBOOT - shutdown_nice(RB_HALT); + if (!disable_reboot_key) + shutdown_nice(RB_HALT); #endif break; case PDWN: #ifndef SC_DISABLE_REBOOT - shutdown_nice(RB_HALT|RB_POWEROFF); + if (!disable_reboot_key) + shutdown_nice(RB_HALT|RB_POWEROFF); #endif break; --EVF5PPMfhYS0aIcm-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010521123044.H29180>