Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/sysctl Descend into kern.tkstat.



details:   https://anonhg.NetBSD.org/src/rev/e5baad80ac27
branches:  trunk
changeset: 521312:e5baad80ac27
user:      simonb <simonb%NetBSD.org@localhost>
date:      Mon Jan 28 02:07:40 2002 +0000

description:
Descend into kern.tkstat.

diffstat:

 sbin/sysctl/sysctl.c |  32 ++++++++++++++++++++++++++++++--
 1 files changed, 30 insertions(+), 2 deletions(-)

diffs (67 lines):

diff -r 13c8b69c6034 -r e5baad80ac27 sbin/sysctl/sysctl.c
--- a/sbin/sysctl/sysctl.c      Mon Jan 28 02:07:01 2002 +0000
+++ b/sbin/sysctl/sysctl.c      Mon Jan 28 02:07:40 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysctl.c,v 1.53 2002/01/28 01:37:17 simonb Exp $       */
+/*     $NetBSD: sysctl.c,v 1.54 2002/01/28 02:07:40 simonb Exp $       */
 
 /*
  * Copyright (c) 1993
@@ -44,7 +44,7 @@
 #if 0
 static char sccsid[] = "@(#)sysctl.c   8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: sysctl.c,v 1.53 2002/01/28 01:37:17 simonb Exp $");
+__RCSID("$NetBSD: sysctl.c,v 1.54 2002/01/28 02:07:40 simonb Exp $");
 #endif
 #endif /* not lint */
 
@@ -185,6 +185,7 @@
 static int sysctl_mbuf(char *, char **, int[], int, int *);
 static int sysctl_pipe(char *, char **, int[], int, int *);
 static int sysctl_proc(char *, char **, int[], int, int *);
+static int sysctl_tkstat(char *, char **, int[], int, int *);
 static int findname(char *, char *, char **, struct list *);
 static void usage(void);
 
@@ -402,6 +403,11 @@
                        if (len < 0)
                                return;
                        break;
+               case KERN_TKSTAT:
+                       len = sysctl_tkstat(string, &bufp, mib, flags, &type);
+                       if (len < 0)
+                               return;
+                       break;
                }
                break;
 
@@ -1108,6 +1114,28 @@
        return (3);
 }
 
+struct ctlname tkstatnames[] = KERN_TKSTAT_NAMES;
+struct list tkstatvars = { tkstatnames, KERN_TKSTAT_MAXID };
+/*
+ * handle kern.tkstat requests
+ */
+static int
+sysctl_tkstat(char *string, char **bufpp, int mib[], int flags, int *typep)
+{
+       struct list *lp = &tkstatvars;
+       int indx;
+
+       if (*bufpp == NULL) {
+               listall(string, lp);
+               return (-1);
+       }
+       if ((indx = findname(string, "third", bufpp, lp)) == -1)
+               return (-1);
+       mib[2] = indx;
+       *typep = lp->list[indx].ctl_type;
+       return (3);
+}
+
 /*
  * Scan a list of names searching for a particular name.
  */



Home | Main Index | Thread Index | Old Index