1/*-
2 * Copyright (c) 1983, 1988, 1993, 1995
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 24 unchanged lines hidden (view full) ---
33
34#if 0
35#ifndef lint
36static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95";
37#endif /* not lint */
38#endif
39
40#include <sys/cdefs.h>
41__FBSDID("$FreeBSD: head/usr.bin/netstat/inet.c 175077 2008-01-04 03:09:28Z obrien $");
42
43#include <sys/param.h>
44#include <sys/queue.h>
45#include <sys/domain.h>
46#include <sys/socket.h>
47#include <sys/socketvar.h>
48#include <sys/sysctl.h>
49#include <sys/protosw.h>
--- 87 unchanged lines hidden (view full) ---
137 * nested structures that aren't used to avoid extra work.
138 */
139static void
140sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb)
141{
142 xsb->sb_cc = sb->sb_cc;
143 xsb->sb_hiwat = sb->sb_hiwat;
144 xsb->sb_mbcnt = sb->sb_mbcnt;
145 xsb->sb_mbmax = sb->sb_mbmax;
146 xsb->sb_lowat = sb->sb_lowat;
147 xsb->sb_flags = sb->sb_flags;
148 xsb->sb_timeo = sb->sb_timeo;
149}
150
151int
152sotoxsocket(struct socket *so, struct xsocket *xso)
--- 247 unchanged lines hidden (view full) ---
400 printf(
401 "Current listen queue sizes (qlen/incqlen/maxqlen)");
402 putchar('\n');
403 if (Aflag)
404 printf("%-8.8s ", "Tcpcb");
405 if (Lflag)
406 printf("%-5.5s %-14.14s %-22.22s\n",
407 "Proto", "Listen", "Local Address");
408 else
409 printf((Aflag && !Wflag) ?
410 "%-5.5s %-6.6s %-6.6s %-18.18s %-18.18s %s\n" :
411 "%-5.5s %-6.6s %-6.6s %-22.22s %-22.22s %s\n",
412 "Proto", "Recv-Q", "Send-Q",
413 "Local Address", "Foreign Address",
414 "(state)");
415 first = 0;
416 }
417 if (Lflag && so->so_qlimit == 0)
418 continue;
419 if (Aflag) {
420 if (istcp)
421 printf("%8lx ", (u_long)inp->inp_ppcb);
422 else
--- 10 unchanged lines hidden (view full) ---
433 printf("%-3.3s%-2.2s ", name, vchar);
434 if (Lflag) {
435 char buf1[15];
436
437 snprintf(buf1, 15, "%d/%d/%d", so->so_qlen,
438 so->so_incqlen, so->so_qlimit);
439 printf("%-14.14s ", buf1);
440 } else {
441 printf("%6u %6u ", so->so_rcv.sb_cc, so->so_snd.sb_cc);
442 }
443 if (numeric_port) {
444 if (inp->inp_vflag & INP_IPV4) {
445 inetprint(&inp->inp_laddr, (int)inp->inp_lport,
446 name, 1);
447 if (!Lflag)
448 inetprint(&inp->inp_faddr,
449 (int)inp->inp_fport, name, 1);
--- 39 unchanged lines hidden (view full) ---
489 (int)inp->inp_lport, name, 0);
490 if (!Lflag)
491 inet6print(&inp->in6p_faddr,
492 (int)inp->inp_fport, name,
493 inp->inp_lport != inp->inp_fport);
494 } /* else nothing printed now */
495#endif /* INET6 */
496 }
497 if (istcp && !Lflag) {
498 if (tp->t_state < 0 || tp->t_state >= TCP_NSTATES)
499 printf("%d", tp->t_state);
500 else {
501 printf("%s", tcpstates[tp->t_state]);
502#if defined(TF_NEEDSYN) && defined(TF_NEEDFIN)
503 /* Show T/TCP `hidden state' */
504 if (tp->t_flags & (TF_NEEDSYN|TF_NEEDFIN))
505 putchar('*');
506#endif /* defined(TF_NEEDSYN) && defined(TF_NEEDFIN) */
507 }
508 }
509 putchar('\n');
510 }
511 if (xig != oxig && xig->xig_gen != oxig->xig_gen) {
512 if (oxig->xig_count > xig->xig_count) {
513 printf("Some %s sockets may have been deleted.\n",
514 name);
515 } else if (oxig->xig_count < xig->xig_count) {
516 printf("Some %s sockets may have been created.\n",
--- 609 unchanged lines hidden ---
2 * Copyright (c) 1983, 1988, 1993, 1995
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 24 unchanged lines hidden (view full) ---
33
34#if 0
35#ifndef lint
36static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95";
37#endif /* not lint */
38#endif
39
40#include <sys/cdefs.h>
41__FBSDID("$FreeBSD: head/usr.bin/netstat/inet.c 175077 2008-01-04 03:09:28Z obrien $");
42
43#include <sys/param.h>
44#include <sys/queue.h>
45#include <sys/domain.h>
46#include <sys/socket.h>
47#include <sys/socketvar.h>
48#include <sys/sysctl.h>
49#include <sys/protosw.h>
--- 87 unchanged lines hidden (view full) ---
137 * nested structures that aren't used to avoid extra work.
138 */
139static void
140sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb)
141{
142 xsb->sb_cc = sb->sb_cc;
143 xsb->sb_hiwat = sb->sb_hiwat;
144 xsb->sb_mbcnt = sb->sb_mbcnt;
145 xsb->sb_mbmax = sb->sb_mbmax;
146 xsb->sb_lowat = sb->sb_lowat;
147 xsb->sb_flags = sb->sb_flags;
148 xsb->sb_timeo = sb->sb_timeo;
149}
150
151int
152sotoxsocket(struct socket *so, struct xsocket *xso)
--- 247 unchanged lines hidden (view full) ---
400 printf(
401 "Current listen queue sizes (qlen/incqlen/maxqlen)");
402 putchar('\n');
403 if (Aflag)
404 printf("%-8.8s ", "Tcpcb");
405 if (Lflag)
406 printf("%-5.5s %-14.14s %-22.22s\n",
407 "Proto", "Listen", "Local Address");
408 else
409 printf((Aflag && !Wflag) ?
410 "%-5.5s %-6.6s %-6.6s %-18.18s %-18.18s %s\n" :
411 "%-5.5s %-6.6s %-6.6s %-22.22s %-22.22s %s\n",
412 "Proto", "Recv-Q", "Send-Q",
413 "Local Address", "Foreign Address",
414 "(state)");
415 first = 0;
416 }
417 if (Lflag && so->so_qlimit == 0)
418 continue;
419 if (Aflag) {
420 if (istcp)
421 printf("%8lx ", (u_long)inp->inp_ppcb);
422 else
--- 10 unchanged lines hidden (view full) ---
433 printf("%-3.3s%-2.2s ", name, vchar);
434 if (Lflag) {
435 char buf1[15];
436
437 snprintf(buf1, 15, "%d/%d/%d", so->so_qlen,
438 so->so_incqlen, so->so_qlimit);
439 printf("%-14.14s ", buf1);
440 } else {
441 printf("%6u %6u ", so->so_rcv.sb_cc, so->so_snd.sb_cc);
442 }
443 if (numeric_port) {
444 if (inp->inp_vflag & INP_IPV4) {
445 inetprint(&inp->inp_laddr, (int)inp->inp_lport,
446 name, 1);
447 if (!Lflag)
448 inetprint(&inp->inp_faddr,
449 (int)inp->inp_fport, name, 1);
--- 39 unchanged lines hidden (view full) ---
489 (int)inp->inp_lport, name, 0);
490 if (!Lflag)
491 inet6print(&inp->in6p_faddr,
492 (int)inp->inp_fport, name,
493 inp->inp_lport != inp->inp_fport);
494 } /* else nothing printed now */
495#endif /* INET6 */
496 }
497 if (istcp && !Lflag) {
498 if (tp->t_state < 0 || tp->t_state >= TCP_NSTATES)
499 printf("%d", tp->t_state);
500 else {
501 printf("%s", tcpstates[tp->t_state]);
502#if defined(TF_NEEDSYN) && defined(TF_NEEDFIN)
503 /* Show T/TCP `hidden state' */
504 if (tp->t_flags & (TF_NEEDSYN|TF_NEEDFIN))
505 putchar('*');
506#endif /* defined(TF_NEEDSYN) && defined(TF_NEEDFIN) */
507 }
508 }
509 putchar('\n');
510 }
511 if (xig != oxig && xig->xig_gen != oxig->xig_gen) {
512 if (oxig->xig_count > xig->xig_count) {
513 printf("Some %s sockets may have been deleted.\n",
514 name);
515 } else if (oxig->xig_count < xig->xig_count) {
516 printf("Some %s sockets may have been created.\n",
--- 609 unchanged lines hidden ---