FreeBSD Bugzilla – Attachment 10296 Details for
Bug 20681
[PATCH] show service names in netstat and sockstat
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 3.86 KB, created by
Peter Pentchev
on 2000-08-17 13:40:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Peter Pentchev
Created:
2000-08-17 13:40:01 UTC
Size:
3.86 KB
patch
obsolete
>diff -u -urN src/usr.bin/netstat/inet.c mysrc/usr.bin/netstat/inet.c >--- src/usr.bin/netstat/inet.c Thu Jul 20 19:38:54 2000 >+++ mysrc/usr.bin/netstat/inet.c Thu Aug 17 14:57:27 2000 >@@ -695,7 +695,7 @@ > > sprintf(line, "%.*s.", (Aflag && !numeric) ? 12 : 16, inetname(in)); > cp = index(line, '\0'); >- if (!numeric && port) >+ if ((Sflag || !numeric) && port) > sp = getservbyport((int)port, proto); > if (sp || port == 0) > sprintf(cp, "%.15s", sp ? sp->s_name : "*"); >diff -u -urN src/usr.bin/netstat/inet6.c mysrc/usr.bin/netstat/inet6.c >--- src/usr.bin/netstat/inet6.c Tue Aug 8 16:33:35 2000 >+++ mysrc/usr.bin/netstat/inet6.c Thu Aug 17 14:59:40 2000 >@@ -992,7 +992,7 @@ > sprintf(line, "%.*s.", lflag ? 39 : > (Aflag && !numeric) ? 12 : 16, inet6name(in6)); > cp = index(line, '\0'); >- if (!numeric && port) >+ if ((Sflag || !numeric) && port) > GETSERVBYPORT6(port, proto, sp); > if (sp || port == 0) > sprintf(cp, "%.8s", sp ? sp->s_name : "*"); >diff -u -urN src/usr.bin/netstat/iso.c mysrc/usr.bin/netstat/iso.c >--- src/usr.bin/netstat/iso.c Mon Sep 6 10:34:27 1999 >+++ mysrc/usr.bin/netstat/iso.c Thu Aug 17 15:00:51 2000 >@@ -435,7 +435,7 @@ > > *cp++ = '.'; > if(sufxlen) { >- if( !Aflag && !nflag && (ihe=iso_getserventrybytsel(sufx, sufxlen))) { >+ if( !Aflag && (Sflag || !nflag) && (ihe=iso_getserventrybytsel(sufx, sufxlen))) { > Ihe = *ihe; > ihe = &Ihe; > } >diff -u -urN src/usr.bin/netstat/main.c mysrc/usr.bin/netstat/main.c >--- src/usr.bin/netstat/main.c Thu Jul 20 19:38:58 2000 >+++ mysrc/usr.bin/netstat/main.c Thu Aug 17 15:01:46 2000 >@@ -302,7 +302,7 @@ > > af = AF_UNSPEC; > >- while ((ch = getopt(argc, argv, "Aabdf:ghI:lLiM:mN:np:rstuw:")) != -1) >+ while ((ch = getopt(argc, argv, "Aabdf:ghI:lLiM:mN:np:rSstuw:")) != -1) > switch(ch) { > case 'A': > Aflag = 1; >@@ -393,6 +393,9 @@ > case 'r': > rflag = 1; > break; >+ case 'S': >+ Sflag = 1; >+ break; > case 's': > ++sflag; > break; >@@ -696,8 +699,8 @@ > usage() > { > (void)fprintf(stderr, "%s\n%s\n%s\n%s\n", >-"usage: netstat [-AaLln] [-f address_family] [-M core] [-N system]", >-" netstat [-abdghilmnrs] [-f address_family] [-M core] [-N system]", >+"usage: netstat [-AaLlnS] [-f address_family] [-M core] [-N system]", >+" netstat [-abdghilmnrSs] [-f address_family] [-M core] [-N system]", > " netstat [-bdn] [-I interface] [-M core] [-N system] [-w wait]", > " netstat [-M core] [-N system] [-p protocol]"); > exit(1); >diff -u -urN src/usr.bin/netstat/netstat.1 mysrc/usr.bin/netstat/netstat.1 >--- src/usr.bin/netstat/netstat.1 Sat Mar 11 16:33:13 2000 >+++ mysrc/usr.bin/netstat/netstat.1 Thu Aug 17 15:05:17 2000 >@@ -235,6 +235,10 @@ > The program will complain if > .Ar protocol > is unknown or if there is no statistics routine for it. >+.It Fl S >+Show service names even if numeric output has been requested by the >+.Fl n >+option. > .It Fl s > Show per-protocol statistics. > If this option is repeated, counters with a value of zero are suppressed. >diff -u -urN src/usr.bin/netstat/netstat.h mysrc/usr.bin/netstat/netstat.h >--- src/usr.bin/netstat/netstat.h Thu Jul 20 19:38:59 2000 >+++ mysrc/usr.bin/netstat/netstat.h Thu Aug 17 14:55:54 2000 >@@ -48,6 +48,7 @@ > int nflag; /* show addresses numerically */ > int pflag; /* show given protocol */ > int rflag; /* show routing tables (or routing stats) */ >+int Sflag; /* show service names even if -n specified */ > int sflag; /* show protocol statistics */ > int tflag; /* show i/f watchdog timers */ > >diff -u -urN src/usr.bin/sockstat/sockstat.pl mysrc/usr.bin/sockstat/sockstat.pl >--- src/usr.bin/sockstat/sockstat.pl Sat Mar 11 13:25:00 2000 >+++ mysrc/usr.bin/sockstat/sockstat.pl Thu Aug 17 15:08:26 2000 >@@ -40,7 +40,7 @@ > $user, $cmd, $pid, $fd, $proto,$laddr, $faddr > . > >-open NETSTAT, "netstat -Aan |" or die "'netstat' failed: $!"; >+open NETSTAT, "netstat -AanS |" or die "'netstat' failed: $!"; > <NETSTAT>; <NETSTAT>; > > while (<NETSTAT>) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 20681
: 10296