summaryrefslogtreecommitdiff
path: root/sys/dev/cons.c
diff options
context:
space:
mode:
authormlelstv <mlelstv@NetBSD.org>2015-02-23 06:54:12 +0000
committermlelstv <mlelstv@NetBSD.org>2015-02-23 06:54:12 +0000
commit2470c0b661d262fac635317c8bc313557ea987e6 (patch)
tree46944c45fb176c04076733bf57656498368ceba8 /sys/dev/cons.c
parent9c5720ad61ffd740a8dd075430fe933a63b8b54d (diff)
Fall back to nullcons if configured.
Diffstat (limited to 'sys/dev/cons.c')
-rw-r--r--sys/dev/cons.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/dev/cons.c b/sys/dev/cons.c
index 9fb3367244b..b58c7b76df8 100644
--- a/sys/dev/cons.c
+++ b/sys/dev/cons.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cons.c,v 1.72 2014/07/25 08:10:35 dholland Exp $ */
+/* $NetBSD: cons.c,v 1.73 2015/02/23 06:54:12 mlelstv Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.72 2014/07/25 08:10:35 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.73 2015/02/23 06:54:12 mlelstv Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -56,6 +56,8 @@ __KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.72 2014/07/25 08:10:35 dholland Exp $");
#include <dev/cons.h>
+#include "nullcons.h"
+
dev_type_open(cnopen);
dev_type_close(cnclose);
dev_type_read(cnread);
@@ -104,6 +106,11 @@ cnopen(dev_t dev, int flag, int mode, struct lwp *l)
* open() calls.
*/
cndev = cn_tab->cn_dev;
+#if NNULLCONS > 0
+ if (cndev == NODEV) {
+ nullconsattach(0);
+ }
+#else /* NNULLCONS > 0 */
if (cndev == NODEV) {
/*
* This is most likely an error in the console attach
@@ -112,6 +119,7 @@ cnopen(dev_t dev, int flag, int mode, struct lwp *l)
*/
panic("cnopen: no console device");
}
+#endif /* NNULLCONS > 0 */
if (dev == cndev) {
/*
* This causes cnopen() to be called recursively, which