Module Name:    src
Committed By:   mlelstv
Date:           Mon Feb 23 06:54:13 UTC 2015

Modified Files:
        src/sys/dev: cons.c

Log Message:
Fall back to nullcons if configured.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/cons.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/cons.c
diff -u src/sys/dev/cons.c:1.72 src/sys/dev/cons.c:1.73
--- src/sys/dev/cons.c:1.72	Fri Jul 25 08:10:35 2014
+++ src/sys/dev/cons.c	Mon Feb 23 06:54:12 2015
@@ -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.7
 
 #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, st
 	 * 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, st
 		 */
 		panic("cnopen: no console device");
 	}
+#endif /* NNULLCONS > 0 */
 	if (dev == cndev) {
 		/*
 		 * This causes cnopen() to be called recursively, which

Reply via email to