39#include <sys/domain.h>
40#include <sys/kernel.h>
41#include <sys/protosw.h>
42#include <sys/socket.h>
43#include <sys/socketvar.h>
49db_print_sotype(
short so_type)
54 db_printf(
"SOCK_STREAM");
58 db_printf(
"SOCK_DGRAM");
62 db_printf(
"SOCK_RAW");
66 db_printf(
"SOCK_RDM");
70 db_printf(
"SOCK_SEQPACKET");
80db_print_sooptions(
int so_options)
85 if (so_options & SO_DEBUG) {
86 db_printf(
"%sSO_DEBUG", comma ?
", " :
"");
89 if (so_options & SO_ACCEPTCONN) {
90 db_printf(
"%sSO_ACCEPTCONN", comma ?
", " :
"");
93 if (so_options & SO_REUSEADDR) {
94 db_printf(
"%sSO_REUSEADDR", comma ?
", " :
"");
97 if (so_options & SO_KEEPALIVE) {
98 db_printf(
"%sSO_KEEPALIVE", comma ?
", " :
"");
101 if (so_options & SO_DONTROUTE) {
102 db_printf(
"%sSO_DONTROUTE", comma ?
", " :
"");
105 if (so_options & SO_BROADCAST) {
106 db_printf(
"%sSO_BROADCAST", comma ?
", " :
"");
109 if (so_options & SO_USELOOPBACK) {
110 db_printf(
"%sSO_USELOOPBACK", comma ?
", " :
"");
113 if (so_options & SO_LINGER) {
114 db_printf(
"%sSO_LINGER", comma ?
", " :
"");
117 if (so_options & SO_OOBINLINE) {
118 db_printf(
"%sSO_OOBINLINE", comma ?
", " :
"");
121 if (so_options & SO_REUSEPORT) {
122 db_printf(
"%sSO_REUSEPORT", comma ?
", " :
"");
125 if (so_options & SO_REUSEPORT_LB) {
126 db_printf(
"%sSO_REUSEPORT_LB", comma ?
", " :
"");
129 if (so_options & SO_TIMESTAMP) {
130 db_printf(
"%sSO_TIMESTAMP", comma ?
", " :
"");
133 if (so_options & SO_NOSIGPIPE) {
134 db_printf(
"%sSO_NOSIGPIPE", comma ?
", " :
"");
137 if (so_options & SO_ACCEPTFILTER) {
138 db_printf(
"%sSO_ACCEPTFILTER", comma ?
", " :
"");
141 if (so_options & SO_BINTIME) {
142 db_printf(
"%sSO_BINTIME", comma ?
", " :
"");
145 if (so_options & SO_NO_OFFLOAD) {
146 db_printf(
"%sSO_NO_OFFLOAD", comma ?
", " :
"");
149 if (so_options & SO_NO_DDP) {
150 db_printf(
"%sSO_NO_DDP", comma ?
", " :
"");
156db_print_sostate(
short so_state)
161 if (so_state & SS_NOFDREF) {
162 db_printf(
"%sSS_NOFDREF", comma ?
", " :
"");
165 if (so_state & SS_ISCONNECTED) {
166 db_printf(
"%sSS_ISCONNECTED", comma ?
", " :
"");
169 if (so_state & SS_ISCONNECTING) {
170 db_printf(
"%sSS_ISCONNECTING", comma ?
", " :
"");
173 if (so_state & SS_ISDISCONNECTING) {
174 db_printf(
"%sSS_ISDISCONNECTING", comma ?
", " :
"");
177 if (so_state & SS_NBIO) {
178 db_printf(
"%sSS_NBIO", comma ?
", " :
"");
181 if (so_state & SS_ASYNC) {
182 db_printf(
"%sSS_ASYNC", comma ?
", " :
"");
185 if (so_state & SS_ISCONFIRMING) {
186 db_printf(
"%sSS_ISCONFIRMING", comma ?
", " :
"");
189 if (so_state & SS_PROTOREF) {
190 db_printf(
"%sSS_PROTOREF", comma ?
", " :
"");
196db_print_soqstate(
int so_qstate)
201 if (so_qstate & SQ_INCOMP) {
202 db_printf(
"%sSQ_INCOMP", comma ?
", " :
"");
205 if (so_qstate & SQ_COMP) {
206 db_printf(
"%sSQ_COMP", comma ?
", " :
"");
212db_print_sbstate(
short sb_state)
217 if (sb_state & SBS_CANTSENDMORE) {
218 db_printf(
"%sSBS_CANTSENDMORE", comma ?
", " :
"");
221 if (sb_state & SBS_CANTRCVMORE) {
222 db_printf(
"%sSBS_CANTRCVMORE", comma ?
", " :
"");
225 if (sb_state & SBS_RCVATMARK) {
226 db_printf(
"%sSBS_RCVATMARK", comma ?
", " :
"");
232db_print_indent(
int indent)
236 for (i = 0; i < indent; i++)
241db_print_domain(
struct domain *d,
const char *domain_name,
int indent)
244 db_print_indent(indent);
245 db_printf(
"%s at %p\n", domain_name, d);
249 db_print_indent(indent);
250 db_printf(
"dom_family: %d ", d->dom_family);
251 db_printf(
"dom_name: %s\n", d->dom_name);
253 db_print_indent(indent);
254 db_printf(
"dom_externalize: %p ", d->dom_externalize);
255 db_printf(
"dom_dispose: %p\n", d->dom_dispose);
257 db_print_indent(indent);
258 db_printf(
"dom_protosw: %p ", d->dom_protosw);
259 db_printf(
"dom_next: %p\n", d->dom_next);
261 db_print_indent(indent);
262 db_printf(
"dom_rtattach: %p ", d->dom_rtattach);
264 db_print_indent(indent);
265 db_printf(
"dom_ifattach: %p ", d->dom_ifattach);
266 db_printf(
"dom_ifdetach: %p\n", d->dom_ifdetach);
270db_print_prflags(
short pr_flags)
275 if (pr_flags & PR_ATOMIC) {
276 db_printf(
"%sPR_ATOMIC", comma ?
", " :
"");
279 if (pr_flags & PR_ADDR) {
280 db_printf(
"%sPR_ADDR", comma ?
", " :
"");
283 if (pr_flags & PR_CONNREQUIRED) {
284 db_printf(
"%sPR_CONNREQUIRED", comma ?
", " :
"");
287 if (pr_flags & PR_WANTRCVD) {
288 db_printf(
"%sPR_WANTRCVD", comma ?
", " :
"");
291 if (pr_flags & PR_RIGHTS) {
292 db_printf(
"%sPR_RIGHTS", comma ?
", " :
"");
295 if (pr_flags & PR_IMPLOPCL) {
296 db_printf(
"%sPR_IMPLOPCL", comma ?
", " :
"");
299 if (pr_flags & PR_LASTHDR) {
300 db_printf(
"%sPR_LASTHDR", comma ?
", " :
"");
306db_print_protosw(
struct protosw *
pr,
const char *prname,
int indent)
309 db_print_indent(indent);
310 db_printf(
"%s at %p\n", prname,
pr);
314 db_print_indent(indent);
315 db_printf(
"pr_type: %d ",
pr->pr_type);
316 db_printf(
"pr_domain: %p\n",
pr->pr_domain);
317 if (
pr->pr_domain != NULL)
318 db_print_domain(
pr->pr_domain,
"pr_domain", indent);
320 db_print_indent(indent);
321 db_printf(
"pr_protocol: %d\n",
pr->pr_protocol);
323 db_print_indent(indent);
324 db_printf(
"pr_flags: %d (",
pr->pr_flags);
325 db_print_prflags(
pr->pr_flags);
328 db_print_indent(indent);
329 db_printf(
"pr_input: %p ",
pr->pr_input);
330 db_printf(
"pr_output: %p ",
pr->pr_output);
331 db_printf(
"pr_ctlinput: %p\n",
pr->pr_ctlinput);
332 db_printf(
"pr_ctloutput: %p ",
pr->pr_ctloutput);
334 db_print_indent(indent);
335 db_printf(
"pr_fasttimo: %p ",
pr->pr_fasttimo);
336 db_printf(
"pr_slowtimo: %p ",
pr->pr_slowtimo);
337 db_printf(
"pr_drain: %p\n",
pr->pr_drain);
341db_print_sbflags(
short sb_flags)
346 if (sb_flags & SB_WAIT) {
347 db_printf(
"%sSB_WAIT", comma ?
", " :
"");
350 if (sb_flags & SB_SEL) {
351 db_printf(
"%sSB_SEL", comma ?
", " :
"");
354 if (sb_flags & SB_ASYNC) {
355 db_printf(
"%sSB_ASYNC", comma ?
", " :
"");
358 if (sb_flags & SB_UPCALL) {
359 db_printf(
"%sSB_UPCALL", comma ?
", " :
"");
362 if (sb_flags & SB_NOINTR) {
363 db_printf(
"%sSB_NOINTR", comma ?
", " :
"");
366 if (sb_flags & SB_AIO) {
367 db_printf(
"%sSB_AIO", comma ?
", " :
"");
370 if (sb_flags & SB_KNOTE) {
371 db_printf(
"%sSB_KNOTE", comma ?
", " :
"");
374 if (sb_flags & SB_AUTOSIZE) {
375 db_printf(
"%sSB_AUTOSIZE", comma ?
", " :
"");
381db_print_sockbuf(
struct sockbuf *sb,
const char *sockbufname,
int indent)
384 db_print_indent(indent);
385 db_printf(
"%s at %p\n", sockbufname, sb);
389 db_print_indent(indent);
390 db_printf(
"sb_state: 0x%x (", sb->sb_state);
391 db_print_sbstate(sb->sb_state);
394 db_print_indent(indent);
395 db_printf(
"sb_mb: %p ", sb->sb_mb);
396 db_printf(
"sb_mbtail: %p ", sb->sb_mbtail);
397 db_printf(
"sb_lastrecord: %p\n", sb->sb_lastrecord);
399 db_print_indent(indent);
400 db_printf(
"sb_sndptr: %p ", sb->sb_sndptr);
401 db_printf(
"sb_sndptroff: %u\n", sb->sb_sndptroff);
403 db_print_indent(indent);
404 db_printf(
"sb_acc: %u ", sb->sb_acc);
405 db_printf(
"sb_ccc: %u ", sb->sb_ccc);
406 db_printf(
"sb_hiwat: %u ", sb->sb_hiwat);
407 db_printf(
"sb_mbcnt: %u ", sb->sb_mbcnt);
408 db_printf(
"sb_mbmax: %u\n", sb->sb_mbmax);
410 db_print_indent(indent);
411 db_printf(
"sb_mcnt: %u ", sb->sb_mcnt);
412 db_printf(
"sb_ccnt: %u ", sb->sb_ccnt);
413 db_printf(
"sb_ctl: %u ", sb->sb_ctl);
414 db_printf(
"sb_lowat: %d ", sb->sb_lowat);
415 db_printf(
"sb_timeo: %jd\n", sb->sb_timeo);
417 db_print_indent(indent);
418 db_printf(
"sb_flags: 0x%x (", sb->sb_flags);
419 db_print_sbflags(sb->sb_flags);
422 db_print_indent(indent);
423 db_printf(
"sb_aiojobq first: %p\n", TAILQ_FIRST(&sb->sb_aiojobq));
427db_print_socket(
struct socket *so,
const char *socketname,
int indent)
430 db_print_indent(indent);
431 db_printf(
"%s at %p\n", socketname, so);
435 db_print_indent(indent);
436 db_printf(
"so_count: %d ", so->so_count);
437 db_printf(
"so_type: %d (", so->so_type);
438 db_print_sotype(so->so_type);
441 db_print_indent(indent);
442 db_printf(
"so_options: 0x%x (", so->so_options);
443 db_print_sooptions(so->so_options);
446 db_print_indent(indent);
447 db_printf(
"so_linger: %d ", so->so_linger);
448 db_printf(
"so_state: 0x%x (", so->so_state);
449 db_print_sostate(so->so_state);
452 db_print_indent(indent);
453 db_printf(
"so_pcb: %p ", so->so_pcb);
454 db_printf(
"so_proto: %p\n", so->so_proto);
456 if (so->so_proto != NULL)
457 db_print_protosw(so->so_proto,
"so_proto", indent);
459 db_print_indent(indent);
460 if (so->so_options & SO_ACCEPTCONN) {
461 db_printf(
"sol_incomp first: %p ",
462 TAILQ_FIRST(&so->sol_incomp));
463 db_printf(
"sol_comp first: %p\n", TAILQ_FIRST(&so->sol_comp));
464 db_printf(
"sol_qlen: %d ", so->sol_qlen);
465 db_printf(
"sol_incqlen: %d ", so->sol_incqlen);
466 db_printf(
"sol_qlimit: %d ", so->sol_qlimit);
468 db_printf(
"so_qstate: 0x%x (", so->so_qstate);
469 db_print_soqstate(so->so_qstate);
471 db_printf(
"so_listen: %p ", so->so_listen);
473 db_printf(
"so_timeo: %d ", so->so_timeo);
474 db_printf(
"so_error: %d\n", so->so_error);
476 db_print_indent(indent);
477 db_printf(
"so_sigio: %p ", so->so_sigio);
478 db_printf(
"so_oobmark: %lu\n", so->so_oobmark);
480 db_print_sockbuf(&so->so_rcv,
"so_rcv", indent);
481 db_print_sockbuf(&so->so_snd,
"so_snd", indent);
485DB_SHOW_COMMAND(socket, db_show_socket)
490 db_printf(
"usage: show socket <addr>\n");
493 so = (
struct socket *)
addr;
495 db_print_socket(so,
"socket", 0);
498DB_SHOW_COMMAND(sockbuf, db_show_sockbuf)
503 db_printf(
"usage: show sockbuf <addr>\n");
506 sb = (
struct sockbuf *)
addr;
508 db_print_sockbuf(sb,
"sockbuf", 0);
511DB_SHOW_COMMAND(protosw, db_show_protosw)
516 db_printf(
"usage: show protosw <addr>\n");
519 pr = (
struct protosw *)
addr;
521 db_print_protosw(
pr,
"protosw", 0);
524DB_SHOW_COMMAND(
domain, db_show_domain)
529 db_printf(
"usage: show protosw <addr>\n");
534 db_print_domain(d,
"domain", 0);
static struct pollrec pr[POLL_LIST_LEN]
struct iommu_domain ** domain