Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysctl Add support for kern.mbuf.*



details:   https://anonhg.NetBSD.org/src/rev/2f696d2e08ad
branches:  trunk
changeset: 472288:2f696d2e08ad
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Apr 26 22:13:52 1999 +0000

description:
Add support for kern.mbuf.*

diffstat:

 usr.sbin/sysctl/sysctl.8 |   7 ++++++-
 usr.sbin/sysctl/sysctl.c |  39 +++++++++++++++++++++++++++++++++++++--
 2 files changed, 43 insertions(+), 3 deletions(-)

diffs (102 lines):

diff -r fe84269a8fc1 -r 2f696d2e08ad usr.sbin/sysctl/sysctl.8
--- a/usr.sbin/sysctl/sysctl.8  Mon Apr 26 22:04:28 1999 +0000
+++ b/usr.sbin/sysctl/sysctl.8  Mon Apr 26 22:13:52 1999 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: sysctl.8,v 1.27 1999/03/28 17:18:45 kleink Exp $
+.\"    $NetBSD: sysctl.8,v 1.28 1999/04/26 22:13:52 thorpej Exp $
 .\"
 .\" Copyright (c) 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -140,6 +140,11 @@
 .It kern.shortcorename integer yes
 .It kern.synchronized_io       integer no
 .It kern.iov_max       integer no
+.It kern.mbuf.msize    integer no
+.It kern.mbuf.mclsize  integer no
+.It kern.mbuf.nmbclusters      integer raise only
+.It kern.mbuf.mblowat  integer yes
+.It kern.mbuf.mcllowat integer yes
 .It vm.loadavg struct  no
 .It machdep.console_device     dev_t   no
 .It net.inet.ip.forwarding     integer yes
diff -r fe84269a8fc1 -r 2f696d2e08ad usr.sbin/sysctl/sysctl.c
--- a/usr.sbin/sysctl/sysctl.c  Mon Apr 26 22:04:28 1999 +0000
+++ b/usr.sbin/sysctl/sysctl.c  Mon Apr 26 22:13:52 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysctl.c,v 1.18 1998/11/13 20:56:21 thorpej Exp $      */
+/*     $NetBSD: sysctl.c,v 1.19 1999/04/26 22:13:52 thorpej 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.18 1998/11/13 20:56:21 thorpej Exp $");
+__RCSID("$NetBSD: sysctl.c,v 1.19 1999/04/26 22:13:52 thorpej Exp $");
 #endif
 #endif /* not lint */
 
@@ -54,6 +54,7 @@
 #include <sys/sysctl.h>
 #include <sys/socket.h>
 #include <sys/mount.h>
+#include <sys/mbuf.h>
 #include <vm/vm_param.h>
 #include <machine/cpu.h>
 
@@ -139,6 +140,7 @@
 static int sysctl_inet __P((char *, char **, int[], int, int *));
 static int sysctl_vfs __P((char *, char **, int[], int, int *));
 static int sysctl_vfsgen __P((char *, char **, int[], int, int *));
+static int sysctl_mbuf __P((char *, char **, int[], int, int *));
 static int findname __P((char *, char *, char **, struct list *));
 static void usage __P((void));
 
@@ -308,6 +310,11 @@
                        warnx("Use xntpdc -c kerninfo to view %s information",
                            string);
                        return;
+               case KERN_MBUF:
+                       len = sysctl_mbuf(string, &bufp, mib, flags, &type);
+                       if (len < 0)
+                               return;
+                       break;
                }
                break;
 
@@ -681,6 +688,34 @@
        return (3);
 }
 
+struct ctlname mbufnames[] = CTL_MBUF_NAMES;
+struct list mbufvars = { mbufnames, MBUF_MAXID };
+
+/*
+ * handle kern.mbuf requests
+ */
+static int
+sysctl_mbuf(string, bufpp, mib, flags, typep)
+       char *string;
+       char **bufpp;
+       int mib[];
+       int flags;
+       int *typep;
+{
+       struct list *lp = &mbufvars;
+       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