Bug 20808

Summary: netstat -m doesn't use -N or -M arguments, nor warn about it
Product: Base System Reporter: Warner Losh <imp>
Component: miscAssignee: ru <ru>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff
none
p none

Description Warner Losh 2000-08-23 20:50:01 UTC
The netstat -m option reports the number of mbuf in use.  Netstat -N and -M
allow for specification of a core and kernel file to use rather than the 
current running system.  The mbuf stat code in mbuf.h (specifically mbpr)
doesn't fallback to getting the information from core file.  Nor
does it warn about it :-(

Fix: Sadly, all I have is the following:, which I'll commit, but it doesn't
fix the actual bug.  Note, I did a bad thing and cut/paste tabs
so they are likely gone.  But this is for reference only.
How-To-Repeat: Run netstat -m -N xxxx -M yyyy on a core file.  Run it many times.
Watch the numbers change.
Comment 1 Garrett A. Wollman 2000-08-23 21:11:48 UTC
<<On Wed, 23 Aug 2000 12:41:19 -0700 (PDT), imp@village.org said:


> The netstat -m option reports the number of mbuf in use.  Netstat -N and -M
> allow for specification of a core and kernel file to use rather than the 
> current running system.  The mbuf stat code in mbuf.h (specifically mbpr)
> doesn't fallback to getting the information from core file.

This is intentional.  Perhaps the documentation should reflect that
`-N' and `-M' are deprecated.

-GAWollman

--
Garrett A. Wollman   | O Siem / We are all family / O Siem / We're all the same
wollman@lcs.mit.edu  | O Siem / The fires of freedom 
Opinions not those of| Dance in the burning flame
MIT, LCS, CRS, or NSA|                     - Susan Aglukark and Chad Irschick
Comment 2 Warner Losh 2000-08-23 21:41:52 UTC
In message <200008232011.QAA20610@khavrinen.lcs.mit.edu> Garrett Wollman writes:
: <<On Wed, 23 Aug 2000 12:41:19 -0700 (PDT), imp@village.org said:
: 
: 
: > The netstat -m option reports the number of mbuf in use.  Netstat -N and -M
: > allow for specification of a core and kernel file to use rather than the 
: > current running system.  The mbuf stat code in mbuf.h (specifically mbpr)
: > doesn't fallback to getting the information from core file.
: 
: This is intentional.  Perhaps the documentation should reflect that
: `-N' and `-M' are deprecated.

How do I get the mbuf stats from a core dump then?

Warner
Comment 3 Garrett A. Wollman 2000-08-23 22:15:43 UTC
<<On Wed, 23 Aug 2000 14:41:52 -0600, Warner Losh <imp@village.org> said:

> How do I get the mbuf stats from a core dump then?

(gdb) p mbstat

-GAWollman
Comment 4 Warner Losh 2000-08-23 22:48:46 UTC
In message <200008232115.RAA21032@khavrinen.lcs.mit.edu> Garrett
Wollman writes:
: <<On Wed, 23 Aug 2000 14:41:52 -0600, Warner Losh <imp@village.org> said:
: 
: > How do I get the mbuf stats from a core dump then?
: 
: (gdb) p mbstat

gdb -k kernel.1 vmcore.1
(kgdb) p mbstat
$1 = 6368
(kgdb)

Hmmm, that seems a little thin to me.  Do I need symbols or some kind
of cast?

Warner
Comment 5 Bruce Evans 2000-08-24 07:57:41 UTC
On Wed, 23 Aug 2000 imp@village.org wrote:

> >Description:
> The netstat -m option reports the number of mbuf in use.  Netstat -N and -M
> allow for specification of a core and kernel file to use rather than the 
> current running system.  The mbuf stat code in mbuf.h (specifically mbpr)
> doesn't fallback to getting the information from core file.  Nor
> does it warn about it :-(

Support for "-M core -N system" is mostly dysfunctional.  Support for
dead kernels was mostly in libkvm and was lost when we downgraded to
using only sysctl to read kernel info.  Support for netstat's -m on dead
kernels was lost in the corresponding downgrade in netstat.

Bruce
Comment 6 Warner Losh 2000-08-24 07:59:21 UTC
In message <Pine.BSF.4.21.0008241647140.2882-100000@besplex.bde.org> Bruce Evans writes:
: On Wed, 23 Aug 2000 imp@village.org wrote:
: 
: > >Description:
: > The netstat -m option reports the number of mbuf in use.  Netstat -N and -M
: > allow for specification of a core and kernel file to use rather than the 
: > current running system.  The mbuf stat code in mbuf.h (specifically mbpr)
: > doesn't fallback to getting the information from core file.  Nor
: > does it warn about it :-(
: 
: Support for "-M core -N system" is mostly dysfunctional.  Support for
: dead kernels was mostly in libkvm and was lost when we downgraded to
: using only sysctl to read kernel info.  Support for netstat's -m on dead
: kernels was lost in the corresponding downgrade in netstat.

So is it OK to commit the "Hey stupid don't do that" fix?

Warner
Comment 7 Sheldon Hearn freebsd_committer freebsd_triage 2000-08-24 09:50:03 UTC
Responsible Changed
From-To: freebsd-bugs->ps

Paul's tackling this.
Comment 8 Garrett A. Wollman 2000-08-24 16:12:50 UTC
<<On Wed, 23 Aug 2000 15:48:46 -0600, Warner Losh <imp@village.org> said:

> Hmmm, that seems a little thin to me.  Do I need symbols or some kind
> of cast?

If you have debugging symbols, it should print out the whole
structure.

-GAWollman

--
Garrett A. Wollman   | O Siem / We are all family / O Siem / We're all the same
wollman@lcs.mit.edu  | O Siem / The fires of freedom 
Opinions not those of| Dance in the burning flame
MIT, LCS, CRS, or NSA|                     - Susan Aglukark and Chad Irschick
Comment 9 ru freebsd_committer freebsd_triage 2001-06-12 16:38:13 UTC
On Thu, Aug 24, 2000 at 04:57:41PM +1000, Bruce Evans wrote:
>  On Wed, 23 Aug 2000 imp@village.org wrote:
>  
>  > >Description:
>  > The netstat -m option reports the number of mbuf in use.  Netstat -N and -M
>  > allow for specification of a core and kernel file to use rather than the 
>  > current running system.  The mbuf stat code in mbuf.h (specifically mbpr)
>  > doesn't fallback to getting the information from core file.  Nor
>  > does it warn about it :-(
>  
>  Support for "-M core -N system" is mostly dysfunctional.  Support for
>  dead kernels was mostly in libkvm and was lost when we downgraded to
>  using only sysctl to read kernel info.  Support for netstat's -m on dead
>  kernels was lost in the corresponding downgrade in netstat.
>  
Here's the patch against RELENG_4 sources that (sorta) restores the -N -M
support for -m.  Please review.


Cheers,
-- 
Ruslan Ermilov		Oracle Developer/DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age
Comment 10 ru freebsd_committer freebsd_triage 2001-06-14 16:39:54 UTC
State Changed
From-To: open->closed

I have restored the -N -M support for -m. 


Comment 11 ru freebsd_committer freebsd_triage 2001-06-14 16:39:54 UTC
Responsible Changed
From-To: ps->ru

Increment counter.