sockstat: Add -q option to suppress the header line
MFC after: 1 week Sponsored by: Gandi.net
This commit is contained in:
parent
a81a290f34
commit
ee0afaa9d7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=328279
@ -27,7 +27,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd September 12, 2017
|
||||
.Dd January 23, 2018
|
||||
.Dt SOCKSTAT 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -83,6 +83,8 @@ The
|
||||
argument is a comma-separated list of protocol names,
|
||||
as they are defined in
|
||||
.Xr protocols 5 .
|
||||
.It Fl q
|
||||
Quiet mode, do not print the header line.
|
||||
.It Fl S
|
||||
Display the protocol stack, if applicable.
|
||||
This is currently only implemented for TCP.
|
||||
|
@ -76,6 +76,7 @@ static int opt_c; /* Show connected sockets */
|
||||
static int opt_j; /* Show specified jail */
|
||||
static int opt_L; /* Don't show IPv4 or IPv6 loopback sockets */
|
||||
static int opt_l; /* Show listening sockets */
|
||||
static int opt_q; /* Don't show header */
|
||||
static int opt_S; /* Show protocol stack if applicable */
|
||||
static int opt_s; /* Show protocol state if applicable */
|
||||
static int opt_U; /* Show remote UDP encapsulation port number */
|
||||
@ -1155,6 +1156,7 @@ display(void)
|
||||
struct sock *s;
|
||||
int hash, n, pos;
|
||||
|
||||
if (opt_q != 1) {
|
||||
printf("%-8s %-10s %-5s %-2s %-6s %-*s %-*s",
|
||||
"USER", "COMMAND", "PID", "FD", "PROTO",
|
||||
opt_w ? 45 : 21, "LOCAL ADDRESS",
|
||||
@ -1168,6 +1170,7 @@ display(void)
|
||||
if (opt_S)
|
||||
printf(" %.*s", TCP_FUNCTION_NAME_LEN_MAX, "STACK");
|
||||
printf("\n");
|
||||
}
|
||||
setpassent(1);
|
||||
for (xf = xfiles, n = 0; n < nxfiles; ++n, ++xf) {
|
||||
if (xf->xf_data == NULL)
|
||||
@ -1248,7 +1251,7 @@ main(int argc, char *argv[])
|
||||
int o, i;
|
||||
|
||||
opt_j = -1;
|
||||
while ((o = getopt(argc, argv, "46cj:Llp:P:SsUuvw")) != -1)
|
||||
while ((o = getopt(argc, argv, "46cj:Llp:P:qSsUuvw")) != -1)
|
||||
switch (o) {
|
||||
case '4':
|
||||
opt_4 = 1;
|
||||
@ -1274,6 +1277,8 @@ main(int argc, char *argv[])
|
||||
case 'P':
|
||||
protos_defined = parse_protos(optarg);
|
||||
break;
|
||||
case 'q':
|
||||
opt_q = 1;
|
||||
case 'S':
|
||||
opt_S = 1;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user