summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libc/gen/sysctl.37
-rw-r--r--sbin/sysctl/sysctl.c5
-rw-r--r--sys/kern/kern_sysctl.c11
-rw-r--r--sys/sys/sysctl.h6
4 files changed, 23 insertions, 6 deletions
diff --git a/lib/libc/gen/sysctl.3 b/lib/libc/gen/sysctl.3
index b2a77e88d59..446ea9d11e1 100644
--- a/lib/libc/gen/sysctl.3
+++ b/lib/libc/gen/sysctl.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sysctl.3,v 1.197 2010/06/29 17:04:31 tedu Exp $
+.\" $OpenBSD: sysctl.3,v 1.198 2010/08/19 18:14:14 kettenis Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@@ -27,7 +27,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: June 29 2010 $
+.Dd $Mdocdate: August 19 2010 $
.Dt SYSCTL 3
.Os
.Sh NAME
@@ -410,6 +410,7 @@ information.
.It Dv KERN_BUFCACHEPERCENT No " integer yes"
.It Dv KERN_CCPU No " integer no"
.It Dv KERN_CLOCKRATE No " struct clockinfo no"
+.It Dv KERN_CONSDEV No " dev_t no"
.It Dv KERN_CPTIME No " long[CPUSTATES] no"
.It Dv KERN_CPTIME2 No " u_int64_t[CPUSTATES] no"
.It Dv KERN_CRYPTODEVALLOWSOFT No " integer yes"
@@ -504,6 +505,8 @@ structure is returned.
This structure contains the clock, statistics clock and profiling clock
frequencies, the number of micro-seconds per hz tick, and the clock
skew rate.
+.It Dv KERN_CONSDEV
+The console device.
.It Dv KERN_CPTIME
An array of longs of size
.Li CPUSTATES
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index 96d0f80f256..b71b9acae61 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.c,v 1.172 2010/04/21 19:40:59 deraadt Exp $ */
+/* $OpenBSD: sysctl.c,v 1.173 2010/08/19 18:14:14 kettenis Exp $ */
/* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */
/*
@@ -444,6 +444,9 @@ parse(char *string, int flags)
return;
warnx("use fstat to view %s information", string);
return;
+ case KERN_CONSDEV:
+ special |= CHRDEV;
+ break;
}
break;
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 }, \
}
/*