aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2006-01-14 17:57:17 +0000
committerBrooks Davis <brooks@FreeBSD.org>2006-01-14 17:57:17 +0000
commit30e3426947c6d29e951b633195b9c8c6a165b054 (patch)
treef0830b6fcfb3101450c2f8f6dc6f4b110f86bd76
parent59caf6ec508fe041f9f4528a5d4a383017b49b86 (diff)
downloadsrc-30e3426947c6d29e951b633195b9c8c6a165b054.tar.gz
src-30e3426947c6d29e951b633195b9c8c6a165b054.zip
When SC_DISABLE_KDBKEY or SC_DISABLE_REBOOT are not defined allow the
same behavior to be controlled by the sysctls, hw.syscons.kbd_kbdkey and hw.syscons.kbd_reboot respectively. Apologies to the submitter for taking so long to commit this simple change. PR: kern/72728 Submitted by: Luca Morettoni <morettoni at libero dot it> MFC After: 3 days
Notes
Notes: svn path=/head/; revision=154369
-rw-r--r--share/man/man4/syscons.410
-rw-r--r--sys/dev/syscons/syscons.c29
2 files changed, 35 insertions, 4 deletions
diff --git a/share/man/man4/syscons.4 b/share/man/man4/syscons.4
index 974ca9bbd309..63835e67bf0f 100644
--- a/share/man/man4/syscons.4
+++ b/share/man/man4/syscons.4
@@ -288,10 +288,20 @@ It will prevent users from
entering the kernel debugger (KDB) by pressing the key combination.
KDB will still be invoked when the kernel panics or hits a break point
if it is included in the kernel.
+If this option is not defined, this behavior may be controled at runtime
+by the
+.Xr sysctl 8
+variable
+.Pq Va hw.syscons.kbd_kbdkey .
.It Dv SC_DISABLE_REBOOT
This option disables the ``reboot'' key (by default, it is
.Dv Ctl-Alt-Del ) ,
so that the casual user may not accidentally reboot the system.
+If this option is not defined, this behavior may be controled at runtime
+by the
+.Xr sysctl 8
+variable
+.Pq Va hw.syscons.kbd_reboot .
.It Dv SC_HISTORY_SIZE=N
Sets the size of back scroll buffer to
.Fa N
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index d7a5b14f8c55..e1228d4221ae 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -112,6 +112,15 @@ static char sc_malloc = FALSE;
static int saver_mode = CONS_NO_SAVER; /* LKM/user saver */
static int run_scrn_saver = FALSE; /* should run the saver? */
static int enable_bell = TRUE; /* enable beeper */
+
+#ifndef SC_DISABLE_REBOOT
+static int enable_reboot = TRUE; /* enable keyboard reboot */
+#endif
+
+#ifndef SC_DISABLE_KDBKEY
+static int enable_kdbkey = TRUE; /* enable keyboard debug */
+#endif
+
static long scrn_blank_time = 0; /* screen saver timeout value */
#ifdef DEV_SPLASH
static int scrn_blanked; /* # of blanked screen */
@@ -127,6 +136,14 @@ SYSCTL_INT(_hw_syscons_saver, OID_AUTO, keybonly, CTLFLAG_RW,
&sc_saver_keyb_only, 0, "screen saver interrupted by input only");
SYSCTL_INT(_hw_syscons, OID_AUTO, bell, CTLFLAG_RW, &enable_bell,
0, "enable bell");
+#ifndef SC_DISABLE_REBOOT
+SYSCTL_INT(_hw_syscons, OID_AUTO, kbd_reboot, CTLFLAG_RW|CTLFLAG_SECURE, &enable_reboot,
+ 0, "enable keyboard reboot");
+#endif
+#ifndef SC_DISABLE_KDBKEY
+SYSCTL_INT(_hw_syscons, OID_AUTO, kbd_debug, CTLFLAG_RW|CTLFLAG_SECURE, &enable_kdbkey,
+ 0, "enable keyboard debug");
+#endif
#if !defined(SC_NO_FONT_LOADING) && defined(SC_DFLT_FONT)
#include "font.h"
#endif
@@ -3274,19 +3291,22 @@ next_code:
case RBT:
#ifndef SC_DISABLE_REBOOT
- shutdown_nice(0);
+ if (enable_reboot)
+ shutdown_nice(0);
#endif
break;
case HALT:
#ifndef SC_DISABLE_REBOOT
- shutdown_nice(RB_HALT);
+ if (enable_reboot)
+ shutdown_nice(RB_HALT);
#endif
break;
case PDWN:
#ifndef SC_DISABLE_REBOOT
- shutdown_nice(RB_HALT|RB_POWEROFF);
+ if (enable_reboot)
+ shutdown_nice(RB_HALT|RB_POWEROFF);
#endif
break;
@@ -3299,7 +3319,8 @@ next_code:
case DBG:
#ifndef SC_DISABLE_KDBKEY
- kdb_enter("manual escape to debugger");
+ if (enable_kdbkey)
+ kdb_enter("manual escape to debugger");
#endif
break;