freebsd-skq/usr.bin/netstat
David Malone a5c4836d39 Replace the mbuf external reference counting code with something
that should be better.

The old code counted references to mbuf clusters by using the offset
of the cluster from the start of memory allocated for mbufs and
clusters as an index into an array of chars, which did the reference
counting. If the external storage was not a cluster then reference
counting had to be done by the code using that external storage.

NetBSD's system of linked lists of mbufs was cosidered, but Alfred
felt it would have locking issues when the kernel was made more
SMP friendly.

The system implimented uses a pool of unions to track external
storage. The union contains an int for counting the references and
a pointer for forming a free list. The reference counts are
incremented and decremented atomically and so should be SMP friendly.
This system can track reference counts for any sort of external
storage.

Access to the reference counting stuff is now through macros defined
in mbuf.h, so it should be easier to make changes to the system in
the future.

The possibility of storing the reference count in one of the
referencing mbufs was considered, but was rejected 'cos it would
often leave extra mbufs allocated. Storing the reference count in
the cluster was also considered, but because the external storage
may not be a cluster this isn't an option.

The size of the pool of reference counters is available in the
stats provided by "netstat -m".

PR:		19866
Submitted by:	Bosko Milekic <bmilekic@dsuper.net>
Reviewed by:	alfred (glanced at by others on -net)
2000-08-19 08:32:59 +00:00
..
atalk.c Cleanup towards -Wall 1999-10-21 07:08:56 +00:00
if.c Fix bug: "netstat -si" prints interface information, but the header 2000-07-28 04:05:04 +00:00
inet6.c To make compilable without -DINET6. 2000-08-07 16:39:33 +00:00
inet.c sync with latest kame netstat. basically, more statistics 2000-07-04 16:26:46 +00:00
ipsec.c sync with latest kame netstat. basically, more statistics 2000-07-04 16:26:46 +00:00
ipx.c Cleanup towards -Wall 1999-10-21 07:08:56 +00:00
iso.c Zap $Source$ 1999-09-06 07:34:27 +00:00
main.c Do not display icmp(4) sockets as non-existent bridge(4) sockets. 2000-08-03 14:53:41 +00:00
Makefile sync with latest kame netstat. basically, more statistics 2000-07-04 16:26:46 +00:00
mbuf.c Replace the mbuf external reference counting code with something 2000-08-19 08:32:59 +00:00
mroute6.c To make compilable without -DINET6. 2000-08-07 16:39:33 +00:00
mroute.c sync with latest kame netstat. basically, more statistics 2000-07-04 16:26:46 +00:00
netgraph.c Put include <netgraph.h> back in - problem was due to a cvsup mess on 1999-10-24 02:58:39 +00:00
netstat.1 Add "-l" option description. 2000-03-11 14:33:13 +00:00
netstat.h add pfkeystat. sync with kame 2000-07-05 02:02:54 +00:00
ns.c
route.c sync with latest kame netstat. basically, more statistics 2000-07-04 16:26:46 +00:00
unix.c $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00