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
This commit is contained in:
Brooks Davis 2006-01-14 17:57:17 +00:00
parent 59caf6ec50
commit 30e3426947
2 changed files with 35 additions and 4 deletions

View File

@ -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

View File

@ -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 @@ scgetc(sc_softc_t *sc, u_int flags)
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 @@ scgetc(sc_softc_t *sc, u_int flags)
case DBG:
#ifndef SC_DISABLE_KDBKEY
kdb_enter("manual escape to debugger");
if (enable_kdbkey)
kdb_enter("manual escape to debugger");
#endif
break;