diff options
author | rwatson <rwatson@FreeBSD.org> | 2006-04-23 15:23:31 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2006-04-23 15:23:31 +0000 |
commit | 71b60a8f152d303eee7bed607f070dd8b1eb01a6 (patch) | |
tree | 1f6f8ac739ef4fd4c7fb0aebc1349862c8a230be /sys/netnatm | |
parent | 00366b63e338baa890f4da88ce2dbd32bbafa7b8 (diff) | |
download | FreeBSD-src-71b60a8f152d303eee7bed607f070dd8b1eb01a6.zip FreeBSD-src-71b60a8f152d303eee7bed607f070dd8b1eb01a6.tar.gz |
Update natm PCB debugging code:
- Depend on opt_ddb.h, since npcb_dump() is ifdef'd DDB.
- Include ddb/ddb.h so we can call db_printf() and use DB_SHOW_COMMAND().
- Don't test results of malloc() under DIAGNOSTIC, let the memory allocator
take care of its own invariants.
MFC after: 1 month
Diffstat (limited to 'sys/netnatm')
-rw-r--r-- | sys/netnatm/natm_pcb.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/sys/netnatm/natm_pcb.c b/sys/netnatm/natm_pcb.c index fd22719f..da4317b 100644 --- a/sys/netnatm/natm_pcb.c +++ b/sys/netnatm/natm_pcb.c @@ -36,12 +36,15 @@ * from trying to use each other's VCs. */ +#include "opt_ddb.h" + #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); #include <sys/param.h> -#include <sys/systm.h> +#include <sys/kernel.h> #include <sys/malloc.h> +#include <sys/systm.h> #include <sys/socket.h> #include <sys/socketvar.h> @@ -51,6 +54,8 @@ __FBSDID("$FreeBSD$"); #include <netnatm/natm.h> +#include <ddb/ddb.h> + struct npcblist natm_pcbs; /* @@ -63,12 +68,6 @@ npcb_alloc(int wait) struct natmpcb *npcb; npcb = malloc(sizeof(*npcb), M_PCB, wait | M_ZERO); - -#ifdef DIAGNOSTIC - if (wait == M_WAITOK && npcb == NULL) - panic("npcb_alloc: malloc didn't wait"); -#endif - if (npcb != NULL) npcb->npcb_flags = NPCB_FREE; return (npcb); @@ -150,20 +149,16 @@ done: } #ifdef DDB - -int -npcb_dump(void) +DB_SHOW_COMMAND(natm, db_show_natm) { struct natmpcb *cpcb; - printf("npcb dump:\n"); + db_printf("npcb dump:\n"); LIST_FOREACH(cpcb, &natm_pcbs, pcblist) { - printf("if=%s, vci=%d, vpi=%d, IP=0x%x, sock=%p, flags=0x%x, " - "inq=%d\n", cpcb->npcb_ifp->if_xname, cpcb->npcb_vci, - cpcb->npcb_vpi, cpcb->ipaddr.s_addr, cpcb->npcb_socket, - cpcb->npcb_flags, cpcb->npcb_inq); + db_printf("if=%s, vci=%d, vpi=%d, IP=0x%x, sock=%p, " + "flags=0x%x, inq=%d\n", cpcb->npcb_ifp->if_xname, + cpcb->npcb_vci, cpcb->npcb_vpi, cpcb->ipaddr.s_addr, + cpcb->npcb_socket, cpcb->npcb_flags, cpcb->npcb_inq); } - printf("done\n"); - return (0); } #endif |