1166732Srwatson/*- 2166732Srwatson * Copyright (c) 2007 Robert N. M. Watson 3166732Srwatson * All rights reserved. 4166732Srwatson * 5166732Srwatson * Redistribution and use in source and binary forms, with or without 6166732Srwatson * modification, are permitted provided that the following conditions 7166732Srwatson * are met: 8166732Srwatson * 1. Redistributions of source code must retain the above copyright 9166732Srwatson * notice, this list of conditions and the following disclaimer. 10166732Srwatson * 2. Redistributions in binary form must reproduce the above copyright 11166732Srwatson * notice, this list of conditions and the following disclaimer in the 12166732Srwatson * documentation and/or other materials provided with the distribution. 13166732Srwatson * 14166732Srwatson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15166732Srwatson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16166732Srwatson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17166732Srwatson * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18166732Srwatson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19166732Srwatson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20166732Srwatson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21166732Srwatson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22166732Srwatson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23166732Srwatson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24166732Srwatson * SUCH DAMAGE. 25166732Srwatson */ 26166732Srwatson 27166732Srwatson/* 28166732Srwatson * Debugger routines relating to sockets, protocols, etc, for use in DDB. 29166732Srwatson */ 30166732Srwatson 31166732Srwatson#include <sys/cdefs.h> 32166732Srwatson__FBSDID("$FreeBSD$"); 33166732Srwatson 34166732Srwatson#include "opt_ddb.h" 35166732Srwatson 36166732Srwatson#include <sys/param.h> 37166732Srwatson#include <sys/domain.h> 38166732Srwatson#include <sys/kernel.h> 39166732Srwatson#include <sys/protosw.h> 40166732Srwatson#include <sys/socket.h> 41166732Srwatson#include <sys/socketvar.h> 42166732Srwatson 43166732Srwatson#ifdef DDB 44166732Srwatson#include <ddb/ddb.h> 45166732Srwatson 46166732Srwatsonstatic void 47166732Srwatsondb_print_sotype(short so_type) 48166732Srwatson{ 49166732Srwatson 50166732Srwatson switch (so_type) { 51166732Srwatson case SOCK_STREAM: 52166732Srwatson db_printf("SOCK_STREAM"); 53166732Srwatson break; 54166732Srwatson 55166732Srwatson case SOCK_DGRAM: 56166732Srwatson db_printf("SOCK_DGRAM"); 57166732Srwatson break; 58166732Srwatson 59166732Srwatson case SOCK_RAW: 60166732Srwatson db_printf("SOCK_RAW"); 61166732Srwatson break; 62166732Srwatson 63166732Srwatson case SOCK_RDM: 64166732Srwatson db_printf("SOCK_RDM"); 65166732Srwatson break; 66166732Srwatson 67166732Srwatson case SOCK_SEQPACKET: 68166732Srwatson db_printf("SOCK_SEQPACKET"); 69166732Srwatson break; 70166732Srwatson 71166732Srwatson default: 72166732Srwatson db_printf("unknown"); 73166732Srwatson break; 74166732Srwatson } 75166732Srwatson} 76166732Srwatson 77166732Srwatsonstatic void 78166732Srwatsondb_print_sooptions(short so_options) 79166732Srwatson{ 80166732Srwatson int comma; 81166732Srwatson 82166732Srwatson comma = 0; 83166732Srwatson if (so_options & SO_DEBUG) { 84166732Srwatson db_printf("%sSO_DEBUG", comma ? ", " : ""); 85166732Srwatson comma = 1; 86166732Srwatson } 87166732Srwatson if (so_options & SO_ACCEPTCONN) { 88166732Srwatson db_printf("%sSO_ACCEPTCONN", comma ? ", " : ""); 89166732Srwatson comma = 1; 90166732Srwatson } 91166732Srwatson if (so_options & SO_REUSEADDR) { 92166732Srwatson db_printf("%sSO_REUSEADDR", comma ? ", " : ""); 93166732Srwatson comma = 1; 94166732Srwatson } 95166732Srwatson if (so_options & SO_KEEPALIVE) { 96166732Srwatson db_printf("%sSO_KEEPALIVE", comma ? ", " : ""); 97166732Srwatson comma = 1; 98166732Srwatson } 99166732Srwatson if (so_options & SO_DONTROUTE) { 100166732Srwatson db_printf("%sSO_DONTROUTE", comma ? ", " : ""); 101166732Srwatson comma = 1; 102166732Srwatson } 103166732Srwatson if (so_options & SO_BROADCAST) { 104166732Srwatson db_printf("%sSO_BROADCAST", comma ? ", " : ""); 105166732Srwatson comma = 1; 106166732Srwatson } 107166732Srwatson if (so_options & SO_USELOOPBACK) { 108166732Srwatson db_printf("%sSO_USELOOPBACK", comma ? ", " : ""); 109166732Srwatson comma = 1; 110166732Srwatson } 111166732Srwatson if (so_options & SO_LINGER) { 112166732Srwatson db_printf("%sSO_LINGER", comma ? ", " : ""); 113166732Srwatson comma = 1; 114166732Srwatson } 115166732Srwatson if (so_options & SO_OOBINLINE) { 116166732Srwatson db_printf("%sSO_OOBINLINE", comma ? ", " : ""); 117166732Srwatson comma = 1; 118166732Srwatson } 119166732Srwatson if (so_options & SO_REUSEPORT) { 120166732Srwatson db_printf("%sSO_REUSEPORT", comma ? ", " : ""); 121166732Srwatson comma = 1; 122166732Srwatson } 123166732Srwatson if (so_options & SO_TIMESTAMP) { 124166732Srwatson db_printf("%sSO_TIMESTAMP", comma ? ", " : ""); 125166732Srwatson comma = 1; 126166732Srwatson } 127166732Srwatson if (so_options & SO_NOSIGPIPE) { 128166732Srwatson db_printf("%sSO_NOSIGPIPE", comma ? ", " : ""); 129166732Srwatson comma = 1; 130166732Srwatson } 131166732Srwatson if (so_options & SO_ACCEPTFILTER) { 132166732Srwatson db_printf("%sSO_ACCEPTFILTER", comma ? ", " : ""); 133166732Srwatson comma = 1; 134166732Srwatson } 135166732Srwatson if (so_options & SO_BINTIME) { 136166732Srwatson db_printf("%sSO_BINTIME", comma ? ", " : ""); 137166732Srwatson comma = 1; 138166732Srwatson } 139192802Spjd if (so_options & SO_NO_OFFLOAD) { 140192802Spjd db_printf("%sSO_NO_OFFLOAD", comma ? ", " : ""); 141192802Spjd comma = 1; 142192802Spjd } 143192802Spjd if (so_options & SO_NO_DDP) { 144192802Spjd db_printf("%sSO_NO_DDP", comma ? ", " : ""); 145192802Spjd comma = 1; 146192802Spjd } 147166732Srwatson} 148166732Srwatson 149166732Srwatsonstatic void 150166732Srwatsondb_print_sostate(short so_state) 151166732Srwatson{ 152166732Srwatson int comma; 153166732Srwatson 154166732Srwatson comma = 0; 155166732Srwatson if (so_state & SS_NOFDREF) { 156188390Smbr db_printf("%sSS_NOFDREF", comma ? ", " : ""); 157166732Srwatson comma = 1; 158166732Srwatson } 159166732Srwatson if (so_state & SS_ISCONNECTED) { 160166732Srwatson db_printf("%sSS_ISCONNECTED", comma ? ", " : ""); 161166732Srwatson comma = 1; 162166732Srwatson } 163166732Srwatson if (so_state & SS_ISCONNECTING) { 164166732Srwatson db_printf("%sSS_ISCONNECTING", comma ? ", " : ""); 165166732Srwatson comma = 1; 166166732Srwatson } 167166732Srwatson if (so_state & SS_ISDISCONNECTING) { 168166732Srwatson db_printf("%sSS_ISDISCONNECTING", comma ? ", " : ""); 169166732Srwatson comma = 1; 170166732Srwatson } 171166732Srwatson if (so_state & SS_NBIO) { 172166732Srwatson db_printf("%sSS_NBIO", comma ? ", " : ""); 173166732Srwatson comma = 1; 174166732Srwatson } 175166732Srwatson if (so_state & SS_ASYNC) { 176166732Srwatson db_printf("%sSS_ASYNC", comma ? ", " : ""); 177166732Srwatson comma = 1; 178166732Srwatson } 179166732Srwatson if (so_state & SS_ISCONFIRMING) { 180166732Srwatson db_printf("%sSS_ISCONFIRMING", comma ? ", " : ""); 181166732Srwatson comma = 1; 182166732Srwatson } 183166732Srwatson if (so_state & SS_PROTOREF) { 184166732Srwatson db_printf("%sSS_PROTOREF", comma ? ", " : ""); 185166732Srwatson comma = 1; 186166732Srwatson } 187166732Srwatson} 188166732Srwatson 189166732Srwatsonstatic void 190166732Srwatsondb_print_soqstate(int so_qstate) 191166732Srwatson{ 192166732Srwatson int comma; 193166732Srwatson 194166732Srwatson comma = 0; 195166732Srwatson if (so_qstate & SQ_INCOMP) { 196166732Srwatson db_printf("%sSQ_INCOMP", comma ? ", " : ""); 197166732Srwatson comma = 1; 198166732Srwatson } 199166732Srwatson if (so_qstate & SQ_COMP) { 200166732Srwatson db_printf("%sSQ_COMP", comma ? ", " : ""); 201166732Srwatson comma = 1; 202166732Srwatson } 203166732Srwatson} 204166732Srwatson 205166732Srwatsonstatic void 206166732Srwatsondb_print_sbstate(short sb_state) 207166732Srwatson{ 208166732Srwatson int comma; 209166732Srwatson 210166732Srwatson comma = 0; 211166732Srwatson if (sb_state & SBS_CANTSENDMORE) { 212285741Spluknet db_printf("%sSBS_CANTSENDMORE", comma ? ", " : ""); 213166732Srwatson comma = 1; 214166732Srwatson } 215166732Srwatson if (sb_state & SBS_CANTRCVMORE) { 216285741Spluknet db_printf("%sSBS_CANTRCVMORE", comma ? ", " : ""); 217166732Srwatson comma = 1; 218166732Srwatson } 219166732Srwatson if (sb_state & SBS_RCVATMARK) { 220285741Spluknet db_printf("%sSBS_RCVATMARK", comma ? ", " : ""); 221166732Srwatson comma = 1; 222166732Srwatson } 223166732Srwatson} 224166732Srwatson 225166732Srwatsonstatic void 226166732Srwatsondb_print_indent(int indent) 227166732Srwatson{ 228166732Srwatson int i; 229166732Srwatson 230166732Srwatson for (i = 0; i < indent; i++) 231166732Srwatson db_printf(" "); 232166732Srwatson} 233166732Srwatson 234166732Srwatsonstatic void 235180213Sjuliandb_print_domain(struct domain *d, const char *domain_name, int indent) 236166732Srwatson{ 237166732Srwatson 238166732Srwatson db_print_indent(indent); 239180213Sjulian db_printf("%s at %p\n", domain_name, d); 240166732Srwatson 241166732Srwatson indent += 2; 242166732Srwatson 243166732Srwatson db_print_indent(indent); 244166732Srwatson db_printf("dom_family: %d ", d->dom_family); 245166732Srwatson db_printf("dom_name: %s\n", d->dom_name); 246166732Srwatson 247166732Srwatson db_print_indent(indent); 248166732Srwatson db_printf("dom_init: %p ", d->dom_init); 249166732Srwatson db_printf("dom_externalize: %p ", d->dom_externalize); 250166732Srwatson db_printf("dom_dispose: %p\n", d->dom_dispose); 251166732Srwatson 252166732Srwatson db_print_indent(indent); 253166732Srwatson db_printf("dom_protosw: %p ", d->dom_protosw); 254166732Srwatson db_printf("dom_next: %p\n", d->dom_next); 255166732Srwatson 256166732Srwatson db_print_indent(indent); 257166732Srwatson db_printf("dom_rtattach: %p ", d->dom_rtattach); 258166732Srwatson 259166732Srwatson db_print_indent(indent); 260166732Srwatson db_printf("dom_ifattach: %p ", d->dom_ifattach); 261166732Srwatson db_printf("dom_ifdetach: %p\n", d->dom_ifdetach); 262166732Srwatson} 263166732Srwatson 264166732Srwatsonstatic void 265166732Srwatsondb_print_prflags(short pr_flags) 266166732Srwatson{ 267166732Srwatson int comma; 268166732Srwatson 269166732Srwatson comma = 0; 270166732Srwatson if (pr_flags & PR_ATOMIC) { 271166732Srwatson db_printf("%sPR_ATOMIC", comma ? ", " : ""); 272166732Srwatson comma = 1; 273166732Srwatson } 274166732Srwatson if (pr_flags & PR_ADDR) { 275166732Srwatson db_printf("%sPR_ADDR", comma ? ", " : ""); 276166732Srwatson comma = 1; 277166732Srwatson } 278166732Srwatson if (pr_flags & PR_CONNREQUIRED) { 279166732Srwatson db_printf("%sPR_CONNREQUIRED", comma ? ", " : ""); 280166732Srwatson comma = 1; 281166732Srwatson } 282166732Srwatson if (pr_flags & PR_WANTRCVD) { 283166732Srwatson db_printf("%sPR_WANTRCVD", comma ? ", " : ""); 284166732Srwatson comma = 1; 285166732Srwatson } 286166732Srwatson if (pr_flags & PR_RIGHTS) { 287166732Srwatson db_printf("%sPR_RIGHTS", comma ? ", " : ""); 288166732Srwatson comma = 1; 289166732Srwatson } 290166732Srwatson if (pr_flags & PR_IMPLOPCL) { 291166732Srwatson db_printf("%sPR_IMPLOPCL", comma ? ", " : ""); 292166732Srwatson comma = 1; 293166732Srwatson } 294166732Srwatson if (pr_flags & PR_LASTHDR) { 295166732Srwatson db_printf("%sPR_LASTHDR", comma ? ", " : ""); 296166732Srwatson comma = 1; 297166732Srwatson } 298166732Srwatson} 299166732Srwatson 300166732Srwatsonstatic void 301166732Srwatsondb_print_protosw(struct protosw *pr, const char *prname, int indent) 302166732Srwatson{ 303166732Srwatson 304166732Srwatson db_print_indent(indent); 305166732Srwatson db_printf("%s at %p\n", prname, pr); 306166732Srwatson 307166732Srwatson indent += 2; 308166732Srwatson 309166732Srwatson db_print_indent(indent); 310166732Srwatson db_printf("pr_type: %d ", pr->pr_type); 311166732Srwatson db_printf("pr_domain: %p\n", pr->pr_domain); 312166732Srwatson if (pr->pr_domain != NULL) 313166732Srwatson db_print_domain(pr->pr_domain, "pr_domain", indent); 314166732Srwatson 315166732Srwatson db_print_indent(indent); 316166732Srwatson db_printf("pr_protocol: %d\n", pr->pr_protocol); 317166732Srwatson 318166732Srwatson db_print_indent(indent); 319166732Srwatson db_printf("pr_flags: %d (", pr->pr_flags); 320166732Srwatson db_print_prflags(pr->pr_flags); 321166732Srwatson db_printf(")\n"); 322166732Srwatson 323166732Srwatson db_print_indent(indent); 324166732Srwatson db_printf("pr_input: %p ", pr->pr_input); 325166732Srwatson db_printf("pr_output: %p ", pr->pr_output); 326166732Srwatson db_printf("pr_ctlinput: %p\n", pr->pr_ctlinput); 327166732Srwatson 328166732Srwatson db_print_indent(indent); 329166732Srwatson db_printf("pr_ctloutput: %p ", pr->pr_ctloutput); 330166732Srwatson db_printf("pr_init: %p\n", pr->pr_init); 331166732Srwatson 332166732Srwatson db_print_indent(indent); 333166732Srwatson db_printf("pr_fasttimo: %p ", pr->pr_fasttimo); 334166732Srwatson db_printf("pr_slowtimo: %p ", pr->pr_slowtimo); 335166732Srwatson db_printf("pr_drain: %p\n", pr->pr_drain); 336166732Srwatson 337166732Srwatson db_print_indent(indent); 338166732Srwatson} 339166732Srwatson 340166732Srwatsonstatic void 341166732Srwatsondb_print_sbflags(short sb_flags) 342166732Srwatson{ 343166732Srwatson int comma; 344166732Srwatson 345166732Srwatson comma = 0; 346166732Srwatson if (sb_flags & SB_WAIT) { 347166732Srwatson db_printf("%sSB_WAIT", comma ? ", " : ""); 348166732Srwatson comma = 1; 349166732Srwatson } 350166732Srwatson if (sb_flags & SB_SEL) { 351166732Srwatson db_printf("%sSB_SEL", comma ? ", " : ""); 352166732Srwatson comma = 1; 353166732Srwatson } 354166732Srwatson if (sb_flags & SB_ASYNC) { 355166732Srwatson db_printf("%sSB_ASYNC", comma ? ", " : ""); 356166732Srwatson comma = 1; 357166732Srwatson } 358166732Srwatson if (sb_flags & SB_UPCALL) { 359166732Srwatson db_printf("%sSB_UPCALL", comma ? ", " : ""); 360166732Srwatson comma = 1; 361166732Srwatson } 362166732Srwatson if (sb_flags & SB_NOINTR) { 363166732Srwatson db_printf("%sSB_NOINTR", comma ? ", " : ""); 364166732Srwatson comma = 1; 365166732Srwatson } 366166732Srwatson if (sb_flags & SB_AIO) { 367166732Srwatson db_printf("%sSB_AIO", comma ? ", " : ""); 368166732Srwatson comma = 1; 369166732Srwatson } 370166732Srwatson if (sb_flags & SB_KNOTE) { 371166732Srwatson db_printf("%sSB_KNOTE", comma ? ", " : ""); 372166732Srwatson comma = 1; 373166732Srwatson } 374166732Srwatson if (sb_flags & SB_AUTOSIZE) { 375166732Srwatson db_printf("%sSB_AUTOSIZE", comma ? ", " : ""); 376166732Srwatson comma = 1; 377166732Srwatson } 378166732Srwatson} 379166732Srwatson 380166732Srwatsonstatic void 381166732Srwatsondb_print_sockbuf(struct sockbuf *sb, const char *sockbufname, int indent) 382166732Srwatson{ 383166732Srwatson 384166732Srwatson db_print_indent(indent); 385166732Srwatson db_printf("%s at %p\n", sockbufname, sb); 386166732Srwatson 387166732Srwatson indent += 2; 388166732Srwatson 389166732Srwatson db_print_indent(indent); 390166732Srwatson db_printf("sb_state: 0x%x (", sb->sb_state); 391166732Srwatson db_print_sbstate(sb->sb_state); 392166732Srwatson db_printf(")\n"); 393166732Srwatson 394166732Srwatson db_print_indent(indent); 395166732Srwatson db_printf("sb_mb: %p ", sb->sb_mb); 396166732Srwatson db_printf("sb_mbtail: %p ", sb->sb_mbtail); 397166732Srwatson db_printf("sb_lastrecord: %p\n", sb->sb_lastrecord); 398166732Srwatson 399166732Srwatson db_print_indent(indent); 400175071Sbz db_printf("sb_sndptr: %p ", sb->sb_sndptr); 401175071Sbz db_printf("sb_sndptroff: %u\n", sb->sb_sndptroff); 402166732Srwatson 403166732Srwatson db_print_indent(indent); 404275326Sglebius db_printf("sb_acc: %u ", sb->sb_acc); 405275326Sglebius db_printf("sb_ccc: %u ", sb->sb_ccc); 406175071Sbz db_printf("sb_hiwat: %u ", sb->sb_hiwat); 407175071Sbz db_printf("sb_mbcnt: %u ", sb->sb_mbcnt); 408175071Sbz db_printf("sb_mbmax: %u\n", sb->sb_mbmax); 409175071Sbz 410175071Sbz db_print_indent(indent); 411175071Sbz db_printf("sb_ctl: %u ", sb->sb_ctl); 412166732Srwatson db_printf("sb_lowat: %d ", sb->sb_lowat); 413255138Sdavide db_printf("sb_timeo: %jd\n", sb->sb_timeo); 414166732Srwatson 415166732Srwatson db_print_indent(indent); 416166732Srwatson db_printf("sb_flags: 0x%x (", sb->sb_flags); 417166732Srwatson db_print_sbflags(sb->sb_flags); 418166732Srwatson db_printf(")\n"); 419296277Sjhb 420296277Sjhb db_print_indent(indent); 421296277Sjhb db_printf("sb_aiojobq first: %p\n", TAILQ_FIRST(&sb->sb_aiojobq)); 422166732Srwatson} 423166732Srwatson 424166732Srwatsonstatic void 425166732Srwatsondb_print_socket(struct socket *so, const char *socketname, int indent) 426166732Srwatson{ 427166732Srwatson 428166732Srwatson db_print_indent(indent); 429166732Srwatson db_printf("%s at %p\n", socketname, so); 430166732Srwatson 431166732Srwatson indent += 2; 432166732Srwatson 433166732Srwatson db_print_indent(indent); 434166732Srwatson db_printf("so_count: %d ", so->so_count); 435166732Srwatson db_printf("so_type: %d (", so->so_type); 436166732Srwatson db_print_sotype(so->so_type); 437166732Srwatson db_printf(")\n"); 438166732Srwatson 439166732Srwatson db_print_indent(indent); 440166732Srwatson db_printf("so_options: 0x%x (", so->so_options); 441166732Srwatson db_print_sooptions(so->so_options); 442166732Srwatson db_printf(")\n"); 443166732Srwatson 444166732Srwatson db_print_indent(indent); 445166732Srwatson db_printf("so_linger: %d ", so->so_linger); 446166732Srwatson db_printf("so_state: 0x%x (", so->so_state); 447166732Srwatson db_print_sostate(so->so_state); 448166732Srwatson db_printf(")\n"); 449166732Srwatson 450166732Srwatson db_print_indent(indent); 451166732Srwatson db_printf("so_qstate: 0x%x (", so->so_qstate); 452166732Srwatson db_print_soqstate(so->so_qstate); 453166732Srwatson db_printf(") "); 454166732Srwatson db_printf("so_pcb: %p ", so->so_pcb); 455166732Srwatson db_printf("so_proto: %p\n", so->so_proto); 456166732Srwatson 457166732Srwatson if (so->so_proto != NULL) 458166732Srwatson db_print_protosw(so->so_proto, "so_proto", indent); 459166732Srwatson 460166732Srwatson db_print_indent(indent); 461166732Srwatson db_printf("so_head: %p ", so->so_head); 462166732Srwatson db_printf("so_incomp first: %p ", TAILQ_FIRST(&so->so_incomp)); 463166732Srwatson db_printf("so_comp first: %p\n", TAILQ_FIRST(&so->so_comp)); 464166732Srwatson 465166732Srwatson db_print_indent(indent); 466166732Srwatson /* so_list skipped */ 467295136Salfred db_printf("so_qlen: %u ", so->so_qlen); 468295136Salfred db_printf("so_incqlen: %u ", so->so_incqlen); 469295136Salfred db_printf("so_qlimit: %u ", so->so_qlimit); 470166732Srwatson db_printf("so_timeo: %d ", so->so_timeo); 471166732Srwatson db_printf("so_error: %d\n", so->so_error); 472166732Srwatson 473166732Srwatson db_print_indent(indent); 474166732Srwatson db_printf("so_sigio: %p ", so->so_sigio); 475166732Srwatson db_printf("so_oobmark: %lu ", so->so_oobmark); 476166732Srwatson 477166732Srwatson db_print_sockbuf(&so->so_rcv, "so_rcv", indent); 478166732Srwatson db_print_sockbuf(&so->so_snd, "so_snd", indent); 479166732Srwatson} 480166732Srwatson 481166732SrwatsonDB_SHOW_COMMAND(socket, db_show_socket) 482166732Srwatson{ 483166732Srwatson struct socket *so; 484166732Srwatson 485166732Srwatson if (!have_addr) { 486166732Srwatson db_printf("usage: show socket <addr>\n"); 487166732Srwatson return; 488166732Srwatson } 489166732Srwatson so = (struct socket *)addr; 490166732Srwatson 491166732Srwatson db_print_socket(so, "socket", 0); 492166732Srwatson} 493166732Srwatson 494166732SrwatsonDB_SHOW_COMMAND(sockbuf, db_show_sockbuf) 495166732Srwatson{ 496166732Srwatson struct sockbuf *sb; 497166732Srwatson 498166732Srwatson if (!have_addr) { 499166732Srwatson db_printf("usage: show sockbuf <addr>\n"); 500166732Srwatson return; 501166732Srwatson } 502166732Srwatson sb = (struct sockbuf *)addr; 503166732Srwatson 504166732Srwatson db_print_sockbuf(sb, "sockbuf", 0); 505166732Srwatson} 506166732Srwatson 507166732SrwatsonDB_SHOW_COMMAND(protosw, db_show_protosw) 508166732Srwatson{ 509166732Srwatson struct protosw *pr; 510166732Srwatson 511166732Srwatson if (!have_addr) { 512166732Srwatson db_printf("usage: show protosw <addr>\n"); 513166732Srwatson return; 514166732Srwatson } 515166732Srwatson pr = (struct protosw *)addr; 516166732Srwatson 517166732Srwatson db_print_protosw(pr, "protosw", 0); 518166732Srwatson} 519166732Srwatson 520166732SrwatsonDB_SHOW_COMMAND(domain, db_show_domain) 521166732Srwatson{ 522166732Srwatson struct domain *d; 523166732Srwatson 524166732Srwatson if (!have_addr) { 525166732Srwatson db_printf("usage: show protosw <addr>\n"); 526166732Srwatson return; 527166732Srwatson } 528166732Srwatson d = (struct domain *)addr; 529166732Srwatson 530166732Srwatson db_print_domain(d, "domain", 0); 531166732Srwatson} 532166732Srwatson#endif 533