Subject: Re: equivalent of sockstat?
To: None <netbsd-help@netbsd.org>
From: Geert Hendrickx <ghen@hmacs.cmi.ua.ac.be>
List: netbsd-help
Date: 12/27/2004 10:17:15
On Thu, Dec 23, 2004 at 06:03:23PM +0100, Geert Hendrickx wrote:
> But their script basically gets its info from fstat(1) and netstat(1),
> so it must be possible to write something similar for NetBSD (maybe in
> /bin/sh since perl is not in the NetBSD base system either).  I'll look
> into it.  

I tried to work something out in /bin/sh, but it's not evident since
/bin/sh does not have associative arrays, and "for" parses netstat's
output word by word instead of line by line.  Due to this, my program
was O(n^2) (n representing the number of lines in fstat/netstat output),
which makes it visibly slow.  Perl seems to be much better for this kind
of thing (duh).  

Maybe C is the better way to go, but I'm not an experienced C
programmer.  Can someone (Andrew?) look into the C version of sockstat
(from FreeBSD 5.x) and try to port that?  

GH

-- 
:wq