diff options
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_cons.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/sys/kern/kern_cons.c b/sys/kern/kern_cons.c index ad2ba20..8d23bef 100644 --- a/sys/kern/kern_cons.c +++ b/sys/kern/kern_cons.c @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" +#include "opt_syscons.h" #include <sys/param.h> #include <sys/systm.h> @@ -648,3 +649,45 @@ sysbeep(int pitch __unused, int period __unused) #endif +/* + * Temporary support for sc(4) to vt(4) transition. + */ +static char vty_name[16] = ""; +SYSCTL_STRING(_kern, OID_AUTO, vty, CTLFLAG_RDTUN, vty_name, 0, + "Console vty driver"); + +int +vty_enabled(unsigned vty) +{ + static unsigned vty_selected = 0; + + if (vty_selected == 0) { + TUNABLE_STR_FETCH("kern.vty", vty_name, sizeof(vty_name)); + do { +#if defined(DEV_SC) + if (strcmp(vty_name, "sc") == 0) { + vty_selected = VTY_SC; + break; + } +#endif +#if defined(DEV_VT) + if (strcmp(vty_name, "vt") == 0) { + vty_selected = VTY_VT; + break; + } +#endif +#if defined(DEV_SC) + vty_selected = VTY_SC; +#elif defined(DEV_VT) + vty_selected = VTY_VT; +#endif + } while (0); + + if (vty_selected == VTY_VT) + strcpy(vty_name, "vt"); + else if (vty_selected == VTY_SC) + strcpy(vty_name, "sc"); + } + return ((vty_selected & vty) != 0); +} + |