summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>2001-05-14 07:15:34 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>2001-05-14 07:15:34 +0000
commite06e09f2e5c5a78f75db534db2eb1b933e82f0ae (patch)
tree27106ab760f365f0d9240c36e602c8d222bbfc5d
parent2179f2cbd664881060423fbf85e36be15cf1378e (diff)
tty stats sysctl, deraadt@ok
-rw-r--r--sys/kern/tty.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index 96466d497d6..de2eccad18b 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.43 2001/03/02 08:04:04 art Exp $ */
+/* $OpenBSD: tty.c,v 1.44 2001/05/14 07:15:33 angelos Exp $ */
/* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */
/*-
@@ -58,6 +58,7 @@
#include <sys/malloc.h>
#include <sys/signalvar.h>
#include <sys/resourcevar.h>
+#include <sys/sysctl.h>
#include <sys/namei.h>
@@ -2330,3 +2331,33 @@ ttyfree(tp)
clfree(&tp->t_outq);
FREE(tp, M_TTYS);
}
+
+/*
+ * Return tty-related information.
+ */
+int
+sysctl_tty(name, namelen, oldp, oldlenp, newp, newlen)
+ int *name;
+ u_int namelen;
+ void *oldp;
+ size_t *oldlenp;
+ void *newp;
+ size_t newlen;
+{
+ if (namelen != 1)
+ return (ENOTDIR);
+
+ switch (name[0]) {
+ case KERN_TTY_TKNIN:
+ return (sysctl_rdquad(oldp, oldlenp, newp, tk_nin));
+ case KERN_TTY_TKNOUT:
+ return (sysctl_rdquad(oldp, oldlenp, newp, tk_nout));
+ case KERN_TTY_TKRAWCC:
+ return (sysctl_rdquad(oldp, oldlenp, newp, tk_rawcc));
+ case KERN_TTY_TKCANCC:
+ return (sysctl_rdquad(oldp, oldlenp, newp, tk_cancc));
+ default:
+ return (EOPNOTSUPP);
+ }
+ /* NOTREACHED */
+}