summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_cons.c
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2011-12-17 15:08:43 +0000
committeravg <avg@FreeBSD.org>2011-12-17 15:08:43 +0000
commitf6def40e18a13286043257337db12d9d78aa545e (patch)
treecf89ca64a6042918d5429b9a17cfaa8421be34c2 /sys/kern/kern_cons.c
parent04ff721cff67dd3e641289f950656b9dbd02d09f (diff)
downloadFreeBSD-src-f6def40e18a13286043257337db12d9d78aa545e.zip
FreeBSD-src-f6def40e18a13286043257337db12d9d78aa545e.tar.gz
kern cons: introduce infrastructure for console grabbing by kernel
At the moment grab and ungrab methods of all console drivers are no-ops. Current intended meaning of the calls is that the kernel takes control of console input. In the future the semantics may be extended to mean that the calling thread takes full ownership of the console (e.g. console output from other threads could be suspended). Inspired by: bde MFC after: 2 months
Diffstat (limited to 'sys/kern/kern_cons.c')
-rw-r--r--sys/kern/kern_cons.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/sys/kern/kern_cons.c b/sys/kern/kern_cons.c
index 42b98cf..75dc881 100644
--- a/sys/kern/kern_cons.c
+++ b/sys/kern/kern_cons.c
@@ -344,6 +344,32 @@ SYSCTL_PROC(_kern, OID_AUTO, consmute, CTLTYPE_INT|CTLFLAG_RW,
0, sizeof(cn_mute), sysctl_kern_consmute, "I",
"State of the console muting");
+void
+cngrab()
+{
+ struct cn_device *cnd;
+ struct consdev *cn;
+
+ STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) {
+ cn = cnd->cnd_cn;
+ if (!kdb_active || !(cn->cn_flags & CN_FLAG_NODEBUG))
+ cn->cn_ops->cn_grab(cn);
+ }
+}
+
+void
+cnungrab()
+{
+ struct cn_device *cnd;
+ struct consdev *cn;
+
+ STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) {
+ cn = cnd->cnd_cn;
+ if (!kdb_active || !(cn->cn_flags & CN_FLAG_NODEBUG))
+ cn->cn_ops->cn_ungrab(cn);
+ }
+}
+
/*
* Low level console routines.
*/
OpenPOWER on IntegriCloud