diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2010-08-19 18:14:15 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2010-08-19 18:14:15 +0000 |
commit | c18462087a5620f613f1e8e0f355ab8aaa083efb (patch) | |
tree | cdee60eb83a06adb7a957117d11f68157736c635 /sys | |
parent | 0f907612e4f9f3908804f40de80d55fc0479f3fb (diff) |
Introduce an MI kern.consdev sysctl that will replace the MD
machdep.console_device that's only implemented on a few architectures.
ok deraadt@, miod@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_sysctl.c | 11 | ||||
-rw-r--r-- | sys/sys/sysctl.h | 6 |
2 files changed, 14 insertions, 3 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 4973cf62f25..67fecfb42ee 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.191 2010/07/26 01:56:27 guenther Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.192 2010/08/19 18:14:14 kettenis Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -77,6 +77,8 @@ #include <sys/mount.h> #include <sys/syscallargs.h> + +#include <dev/cons.h> #include <dev/rndvar.h> #include <dev/systrace.h> @@ -256,6 +258,7 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen, struct proc *p) { int error, level, inthostid, stackgap; + dev_t dev; extern int somaxconn, sominconn; extern int usermount, nosuidcoredump; extern long cp_time[CPUSTATES]; @@ -576,6 +579,12 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, } return(0); } + case KERN_CONSDEV: + if (cn_tab != NULL) + dev = cn_tab->cn_dev; + else + dev = NODEV; + return sysctl_rdstruct(oldp, oldlenp, newp, &dev, sizeof(dev)); default: return (EOPNOTSUPP); } diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index 4eec998f10d..ca5f7dd9ca1 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sysctl.h,v 1.105 2010/07/26 01:56:27 guenther Exp $ */ +/* $OpenBSD: sysctl.h,v 1.106 2010/08/19 18:14:13 kettenis Exp $ */ /* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd Exp $ */ /* @@ -189,7 +189,8 @@ struct ctlname { #define KERN_CACHEPCT 72 /* buffer cache % of physmem */ #define KERN_FILE2 73 /* struct: file entries */ #define KERN_RTHREADS 74 /* kernel rthreads support enabled */ -#define KERN_MAXID 75 /* number of valid kern ids */ +#define KERN_CONSDEV 75 /* dev_t: console terminal device */ +#define KERN_MAXID 76 /* number of valid kern ids */ #define CTL_KERN_NAMES { \ { 0, 0 }, \ @@ -267,6 +268,7 @@ struct ctlname { { "bufcachepercent", CTLTYPE_INT }, \ { "file2", CTLTYPE_STRUCT }, \ { "rthreads", CTLTYPE_INT }, \ + { "consdev", CTLTYPE_STRUCT }, \ } /* |