PERFORCE change 122692 for review
Marko Zec
zec at FreeBSD.org
Mon Jul 2 01:26:49 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=122692
Change 122692 by zec at zec_tpx32 on 2007/07/02 01:26:03
Add a "show vnets" command for DDB. Lists all vnet
instances with a few per-instance details.
Affected files ...
.. //depot/projects/vimage/src/sys/kern/kern_vimage.c#20 edit
Differences ...
==== //depot/projects/vimage/src/sys/kern/kern_vimage.c#20 (text+ko) ====
@@ -30,6 +30,7 @@
* XXX RCS tag goes here
*/
+#include "opt_ddb.h"
#include "opt_vimage.h"
#include <sys/types.h>
@@ -50,6 +51,10 @@
#include <sys/vimage.h>
#include <sys/vmmeter.h>
+#ifdef DDB
+#include <ddb/ddb.h>
+#endif
+
#include <net/vnet.h>
#include <net/bpf.h>
#include <net/if_types.h>
@@ -275,7 +280,7 @@
struct vimage *vip_r = NULL;
struct vimage *tvip;
- error = suser(td);
+ error = suser(td); /* XXX replace with priv(9) */
if (error)
return (error);
@@ -636,3 +641,29 @@
SYSINIT(vimage, SI_SUB_VIMAGE, SI_ORDER_FIRST, vi_init, NULL)
SYSINIT(vimage_done, SI_SUB_VIMAGE_DONE, SI_ORDER_FIRST, vi_init_done, NULL)
+
+#ifdef DDB
+static void
+db_vnet_ptr(void *arg)
+{
+ if (arg)
+ db_printf(" %p", arg);
+ else
+ db_printf(" 0x0");
+}
+
+DB_SHOW_COMMAND(vnets, db_show_vnets)
+{
+ db_printf(" vnet ifcs socks");
+ db_printf(" net inet inet6 netgraph\n");
+ VNET_ITERLOOP_BEGIN_QUIET();
+ db_printf("%p %4d %5d",
+ vnet_iter, vnet_iter->ifccnt, vnet_iter->sockcnt);
+ db_vnet_ptr(vnet_iter->mod_data[VNET_MOD_NET]);
+ db_vnet_ptr(vnet_iter->mod_data[VNET_MOD_INET]);
+ db_vnet_ptr(vnet_iter->mod_data[VNET_MOD_INET6]);
+ db_vnet_ptr(vnet_iter->mod_data[VNET_MOD_NETGRAPH]);
+ db_printf("\n");
+ VNET_ITERLOOP_END();
+}
+#endif
More information about the p4-projects
mailing list