summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorangelos <angelos@openbsd.org>2001-05-14 07:15:33 +0000
committerangelos <angelos@openbsd.org>2001-05-14 07:15:33 +0000
commit675603b3d1eb08d630142c03415e85ca8e397fff (patch)
tree4162dc1d2984e76d75984464130ecba356dc62e9
parentIgnore empty strings in kern.malloc.kmemstat.<foo>, add tty stats. (diff)
downloadwireguard-openbsd-675603b3d1eb08d630142c03415e85ca8e397fff.tar.xz
wireguard-openbsd-675603b3d1eb08d630142c03415e85ca8e397fff.zip
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 */
+}