Subject: Re: equivalent of sockstat?
To: Brian A. Seklecki <lavalamp@spiritual-machines.org>
From: Andrew Brown <atatat@atatdot.net>
List: netbsd-help
Date: 12/26/2004 22:30:25
On Thu, Dec 23, 2004 at 11:13:21AM -0500, Brian A. Seklecki wrote:
>On Thu, 23 Dec 2004, Brian A. Seklecki wrote:
>
>> On Mon, 2004-12-20 at 05:23, Geert Hendrickx wrote:
>>> Hi,
>>>
>>> I'm moving from FreeBSD 4.x to NetBSD 2.0...  But I'm not completely
>>
>> lsof(8) is in pkgsrc.  sockstat can be pretty easily modified; it was a
>
>Apparently it became a binary in 5.x  Perl scipt still available via fbsd 
>cvsweb: 
>http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/sockstat/?only_with_tag=RELENG_4_9_0_RELEASE
>
>IIRC, the portability limitation of sockstat related to netstat(1) flags 
>present in fbsd and not in nbsd/obsd.

out of curiosity (i'd looked at this some time ago, but then became
distracted), i checked a fresh copy of freebsd's sockstat.  adding
this to the top of the file:

    #define __FBSDID __RCSID
    #include <sys/types.h>
    #include <netinet/in.h>
    #include <netinet/tcp_timer.h>
    #include <netinet/ip_var.h>
    #include <netinet/in_systm.h>
    #include <netinet/ip.h>
    #define digittoint(x) ((x) - '0')

gets it mostly to compile (mainly by working around differences in
netinet include files), but we're still tripping over:

    a few structures they have that we don't that are intrinsic to
    this program

    a few sysctl nodes they have that we don't that are intrinsic to
    this program

just some kernel hacking left, it seems.

>Anyway, LSOF

yes.  :)

-- 
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org             * "ah!  i see you have the internet
twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
werdna@squooshy.com       * "information is power -- share the wealth."