summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-21 09:46:22 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-21 09:46:22 +0000
commite60e3b2b1afff9a998bbdd21e91ef348ac30bdce (patch)
treec8413e9d34bb731069acce5daf4b5eb2dd8e4c70 /sys/kern
parentc444c351d96d3e6c9e54118cd1054d8e3232c73b (diff)
spit out a warning if /dev/console does not exist; from mouse@Collatz.McRCIM.McGill.EDU
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/init_main.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 67e3d7f33fc..b2ed4ee4607 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.14 1996/08/13 03:12:41 deraadt Exp $ */
+/* $OpenBSD: init_main.c,v 1.15 1996/08/21 09:46:21 deraadt Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
@@ -53,6 +53,7 @@
#include <sys/resourcevar.h>
#include <sys/signalvar.h>
#include <sys/systm.h>
+#include <sys/namei.h>
#include <sys/vnode.h>
#include <sys/tty.h>
#include <sys/conf.h>
@@ -405,6 +406,24 @@ static char *initpaths[] = {
NULL,
};
+void
+check_console(p)
+ struct proc *p;
+{
+ struct nameidata nd;
+ int error;
+
+ NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, "/dev/console", p);
+ error = namei(&nd);
+ if (error) {
+ if (error == ENOENT)
+ printf("warning: /dev/console does not exist\n");
+ else
+ printf("warning: /dev/console error %d\n", error);
+ } else
+ vrele(nd.ni_vp);
+}
+
/*
* Start the initial user process; try exec'ing each pathname in "initpaths".
* The program is invoked with one argument containing the boot flags.
@@ -440,6 +459,8 @@ start_init(p)
cpu_set_init_frame(p, initframep);
#endif
+ check_console(p);
+
/*
* Need just enough stack to hold the faked-up "execve()" arguments.
*/