summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1995-06-26 07:39:52 +0000
committerbde <bde@FreeBSD.org>1995-06-26 07:39:52 +0000
commitfa86e039e5dacb6dbfeca684d8f7d27674a160c6 (patch)
tree389ad25d5fd8722bb46458fb216ac8b11a3ae144 /sys/i386
parent0a8ca3109e5116fda693de8742179d594ecfbf6d (diff)
downloadFreeBSD-src-fa86e039e5dacb6dbfeca684d8f7d27674a160c6.zip
FreeBSD-src-fa86e039e5dacb6dbfeca684d8f7d27674a160c6.tar.gz
Partially fix `sysctl machdep.console_device'. The fix will be complete
when syscons stops mapping the console to minor MAXCONS. There is usually no corresponding device in /dev, and the correct device has minor 0. cons.c: Initialize cn_tty properly, so that CPU_CONSDEV can work. Comment about too many variants of the console tty pointer. machdep.c: Return device NODEV and not error EFAULT when there is no console device.
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/i386/cons.c11
-rw-r--r--sys/i386/i386/machdep.c8
2 files changed, 14 insertions, 5 deletions
diff --git a/sys/i386/i386/cons.c b/sys/i386/i386/cons.c
index 7e366d8..9f18dd9 100644
--- a/sys/i386/i386/cons.c
+++ b/sys/i386/i386/cons.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
- * $Id: cons.c,v 1.28 1995/05/30 07:59:18 rgrimes Exp $
+ * $Id: cons.c,v 1.29 1995/06/14 04:52:39 bde Exp $
*/
#include <sys/param.h>
@@ -107,9 +107,16 @@ cninit()
cdp->d_open = cnopen;
cn_tp = (*cdp->d_devtotty)(cn_tab->cn_dev);
/*
+ * XXX there are too many tty pointers. cn_tty is only used for
+ * sysctl(CPU_CONSDEV) (not for tprintf like the above comment
+ * says). cn_tp in struct consdev hasn't been initialized
+ * (except statically to NULL) or used (except to initialize
+ * cn_tty to the wrong value) for a year or two.
+ */
+ cn_tty = cn_tp;
+ /*
* Turn on console
*/
- cn_tty = cp->cn_tp;
(*cp->cn_init)(cp);
}
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index 4a2d41d..693e375 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
- * $Id: machdep.c,v 1.127 1995/05/25 07:41:20 davidg Exp $
+ * $Id: machdep.c,v 1.128 1995/05/30 07:59:33 rgrimes Exp $
*/
#include "npx.h"
@@ -998,6 +998,7 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
size_t newlen;
struct proc *p;
{
+ dev_t consdev;
int error;
/* all sysctl names at this level are terminal */
@@ -1006,8 +1007,9 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
switch (name[0]) {
case CPU_CONSDEV:
- return (sysctl_rdstruct(oldp, oldlenp, newp, &cn_tty->t_dev,
- sizeof cn_tty->t_dev));
+ consdev = (cn_tty == NULL ? NODEV : cn_tty->t_dev);
+ return (sysctl_rdstruct(oldp, oldlenp, newp, &consdev,
+ sizeof consdev));
case CPU_ADJKERNTZ:
error = sysctl_int(oldp, oldlenp, newp, newlen, &adjkerntz);
if (!error && newp)
OpenPOWER on IntegriCloud