OpenBSD CVS

CVS log for src/usr.bin/netstat/mbuf.c


[BACK] Up to [local] / src / usr.bin / netstat

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.45 / (download) - annotate - [select for diffs], Sun Jul 16 03:01:31 2023 UTC (10 months ago) by yasuoka
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, HEAD
Changes since 1.44: +3 -3 lines
Diff to previous 1.44 (colored)

Make the mbstat preserve the same size which is actually used.  Also
revert the previous that the mbstat is located on the stack.

ok claudio

Revision 1.44 / (download) - annotate - [select for diffs], Fri Jul 7 14:17:35 2023 UTC (10 months, 1 week ago) by yasuoka
Branch: MAIN
Changes since 1.43: +4 -4 lines
Diff to previous 1.43 (colored)

Expand the counters in struct mbstat from u_short to u_long.

ok blumn mvs

Revision 1.43 / (download) - annotate - [select for diffs], Tue Jul 16 17:39:02 2019 UTC (4 years, 10 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.42: +8 -6 lines
Diff to previous 1.42 (colored)

Prevent integer overflow in kernel and userland when checking mbuf
limits.  Convert kernel variables and calculations for mbuf memory
into long to allow larger values on 64 bit machines.  Put a range
check into the kernel sysctl.  For the interface itself int is still
sufficient.  In netstat -m cast all multiplications to unsigned
long to hold the product of two unsigned int.
input and OK visa@

Revision 1.42 / (download) - annotate - [select for diffs], Fri Jun 28 13:35:02 2019 UTC (4 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.41: +6 -6 lines
Diff to previous 1.41 (colored)

When system calls indicate an error they return -1, not some arbitrary
value < 0.  errno is only updated in this case.  Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.

Revision 1.41 / (download) - annotate - [select for diffs], Thu Jun 13 20:38:54 2019 UTC (4 years, 11 months ago) by bluhm
Branch: MAIN
Changes since 1.40: +2 -2 lines
Diff to previous 1.40 (colored)

Do memory size calculations as unsigned long.  Otherwise
netstat -m would print the result of a signed interger overflow
if kern.maxclusters is 1048576 or above.
OK claudio@

Revision 1.40 / (download) - annotate - [select for diffs], Sat Oct 28 15:25:20 2017 UTC (6 years, 6 months ago) by mikeb
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.39: +20 -13 lines
Diff to previous 1.39 (colored)

Bring "netstat -m" output up to speed with the kernel

The kernel no longer sets watermarks on cluster pools rendering
"max" values useless. Instead, there's now a global limit on how
much memory all cluster pools combined together can allocate from
the system. The limit is set to kern.maxclusters number of 2Kb
increments which allows us to display current, peak and maximum
total memory used by the network.

OK claudio, millert

Revision 1.39 / (download) - annotate - [select for diffs], Sat Feb 4 13:17:08 2017 UTC (7 years, 3 months ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.38: +2 -1 lines
Diff to previous 1.38 (colored)

Include netinet/in.h for in_addr_t now it has moved out of sys/types.h.
gcc warned about this, clang fatally errored.

Revision 1.38 / (download) - annotate - [select for diffs], Fri Oct 28 05:46:14 2016 UTC (7 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.37: +9 -2 lines
Diff to previous 1.37 (colored)

there's a new mbuf cluster pool.

Revision 1.37 / (download) - annotate - [select for diffs], Mon Apr 4 16:26:00 2016 UTC (8 years, 1 month ago) by sthen
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.36: +2 -1 lines
Diff to previous 1.36 (colored)

Add sys/queue.h where it's needed. Unbreak userland following recent
removal from mbuf.h.  ok mpi@

Revision 1.36 / (download) - annotate - [select for diffs], Fri Sep 4 08:21:01 2015 UTC (8 years, 8 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.35: +10 -8 lines
Diff to previous 1.35 (colored)

Fix mbuf memory accounting after recent *8 pool size change.

Use the ``pr_pgsize'' argument instead of assuming that pool page
sizes are identical to the value returned by getpagesize(3).

Issue reported by trondd <trondd AT kagu-tsuchi DOT com> on tech@.

ok millert@, tedu@

Revision 1.35 / (download) - annotate - [select for diffs], Tue Jan 20 18:26:57 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.34: +2 -3 lines
Diff to previous 1.34 (colored)

Adjust <sys/param.h> comments regarding use of use of MSIZE, or
delete <sys/param.h> if now possible
ok guenther

Revision 1.34 / (download) - annotate - [select for diffs], Fri Jan 16 06:40:10 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.33: +2 -2 lines
Diff to previous 1.33 (colored)

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible.  Annotate <sys/param.h> lines with their current reasons.  Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc.  Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution.  These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)

Revision 1.33 / (download) - annotate - [select for diffs], Thu Nov 6 12:50:55 2014 UTC (9 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.32: +2 -2 lines
Diff to previous 1.32 (colored)

i renamed the mbuf pool.

Revision 1.32 / (download) - annotate - [select for diffs], Wed Jul 2 00:12:34 2014 UTC (9 years, 10 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.31: +6 -6 lines
Diff to previous 1.31 (colored)

info about pools is currently given to userland by copying each
pools struct out. however, struct pool in the kernel contains lots
of things that userland probably isnt interested in, like actual
mutexes, and probably shouldnt get easy access to, like pointers
to kernel memory via all the lists/trees.

this implements a kinfo_pool structure that has only the data that
userland needs to know about. it cuts the sysctl code over to
building it from struct pool as required and copying that out
instead, and cuts userland over to only handling kinfo_pool.

the only problem with this is vmstat, which can read kernel images
via kvm, which needs some understanding of struct pool. to cope,
the struct pool definition is guarded by if defined(_KERNEL) ||
defined(_LIBKVM) as inspired by sysctl which needs to do the same
thing sometimes. struct pool itself is generally not visible to
userland though, which is good.

matthew@ suggested struct kinfo_pool instead of struct pool_info.
the kinfo prefix has precedent.
lots of people liked this.

Revision 1.31 / (download) - annotate - [select for diffs], Thu Jul 8 08:47:07 2010 UTC (13 years, 10 months ago) by lum
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.30: +1 -4 lines
Diff to previous 1.30 (colored)

Remove references to kvm.
ok claudio@

Revision 1.30 / (download) - annotate - [select for diffs], Thu Jun 25 22:31:18 2009 UTC (14 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.29: +2 -2 lines
Diff to previous 1.29 (colored)

do not use nitems(); ok claudio

Revision 1.29 / (download) - annotate - [select for diffs], Tue Jan 27 13:49:21 2009 UTC (15 years, 3 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.28: +15 -14 lines
Diff to previous 1.28 (colored)

Fix some interger overflows when accounting the used mbuf memory percentage
and while there use a better type for the plural{,es}() functions.
OK henning@

Revision 1.28 / (download) - annotate - [select for diffs], Thu Dec 4 06:00:47 2008 UTC (15 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.27: +1 -2 lines
Diff to previous 1.27 (colored)

... but without the debug code

Revision 1.27 / (download) - annotate - [select for diffs], Thu Dec 4 05:59:57 2008 UTC (15 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.26: +28 -22 lines
Diff to previous 1.26 (colored)

correctly display information for each of the mbuf cluster pools (which
have different sizes)
ok dlg

Revision 1.26 / (download) - annotate - [select for diffs], Wed Dec 19 01:47:00 2007 UTC (16 years, 5 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.25: +1 -9 lines
Diff to previous 1.25 (colored)

delete rcsid crud

Revision 1.25 / (download) - annotate - [select for diffs], Tue Dec 11 20:14:45 2007 UTC (16 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.24: +3 -3 lines
Diff to previous 1.24 (colored)

mbuf stats are always gotten via sysctl(), so remove old nlist stuff
ok claudio pyr

Revision 1.24 / (download) - annotate - [select for diffs], Wed Dec 21 01:40:24 2005 UTC (18 years, 5 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0, OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.23: +3 -3 lines
Diff to previous 1.23 (colored)

Userland programs should include <errno.h> not <sys/errno.h>
OK deraadt@

Revision 1.23 / (download) - annotate - [select for diffs], Mon May 23 17:35:59 2005 UTC (19 years ago) by marius
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.22: +47 -63 lines
Diff to previous 1.22 (colored)

remove dead and wrong code.

Revision 1.22 / (download) - annotate - [select for diffs], Fri Mar 25 17:01:04 2005 UTC (19 years, 1 month ago) by jaredy
Branch: MAIN
Changes since 1.21: +5 -5 lines
Diff to previous 1.21 (colored)

kill unneeded (char *) casts.  ok millert, otto

Revision 1.21 / (download) - annotate - [select for diffs], Fri Apr 16 23:06:56 2004 UTC (20 years, 1 month ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.20: +8 -7 lines
Diff to previous 1.20 (colored)

print clusters, not pages.  half from millert@  ok deraadt@ millert@

Revision 1.20 / (download) - annotate - [select for diffs], Tue Aug 19 14:30:11 2003 UTC (20 years, 9 months ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5, OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.19: +3 -3 lines
Diff to previous 1.19 (colored)

number of mbuf clusters is not the same as number of pages allocated for 'em; noticed by dsb@uvm.poi.dvo.ru

Revision 1.19 / (download) - annotate - [select for diffs], Tue Jun 3 02:56:13 2003 UTC (20 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.18: +3 -7 lines
Diff to previous 1.18 (colored)

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999.  Proofed by myself and Theo.

Revision 1.18 / (download) - annotate - [select for diffs], Fri Mar 21 16:55:23 2003 UTC (21 years, 2 months ago) by pb
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3
Changes since 1.17: +4 -4 lines
Diff to previous 1.17 (colored)


change 'netstat -m' output from:
0/28 mapped pages in use
to
0/14/1024 mbuf cluster pages in use (current/peak/max)

ok henning@, millert@

Revision 1.17 / (download) - annotate - [select for diffs], Sat Feb 1 01:51:31 2003 UTC (21 years, 3 months ago) by deraadt
Branch: MAIN
Changes since 1.16: +4 -5 lines
Diff to previous 1.16 (colored)

ansi

Revision 1.16 / (download) - annotate - [select for diffs], Sun Jun 30 20:27:16 2002 UTC (21 years, 10 months ago) by angelos
Branch: MAIN
CVS Tags: OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.15: +12 -2 lines
Diff to previous 1.15 (colored)

Correctly retrieve mbuf statistics from the kernel.

Revision 1.15 / (download) - annotate - [select for diffs], Mon Jun 24 17:51:05 2002 UTC (21 years, 11 months ago) by angelos
Branch: MAIN
Changes since 1.14: +3 -3 lines
Diff to previous 1.14 (colored)

KERN_POOL_POOL, not KERN_POOL_NPOOLS --- I wonder how this was not
observed. From dfa@solo.ee and dsb@nt.pin.dvgu.ru

Revision 1.14 / (download) - annotate - [select for diffs], Tue Jun 18 23:49:15 2002 UTC (21 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.13: +3 -2 lines
Diff to previous 1.13 (colored)

pull in missing includes

Revision 1.13 / (download) - annotate - [select for diffs], Sun Jun 9 05:09:09 2002 UTC (21 years, 11 months ago) by angelos
Branch: MAIN
Changes since 1.12: +74 -14 lines
Diff to previous 1.12 (colored)

Begin some sysctl-ization.

Revision 1.12 / (download) - annotate - [select for diffs], Sat Feb 23 01:12:54 2002 UTC (22 years, 3 months ago) by art
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.11: +2 -4 lines
Diff to previous 1.11 (colored)

No more POOL_EXPOSE.

Revision 1.11 / (download) - annotate - [select for diffs], Thu Jan 17 21:34:58 2002 UTC (22 years, 4 months ago) by mickey
Branch: MAIN
Changes since 1.10: +6 -6 lines
Diff to previous 1.10 (colored)

evil, annoying spaces and tabs

Revision 1.10 / (download) - annotate - [select for diffs], Tue Jan 15 22:41:01 2002 UTC (22 years, 4 months ago) by art
Branch: MAIN
Changes since 1.9: +5 -4 lines
Diff to previous 1.9 (colored)

minor simplification in preparation for a future change.

Revision 1.9 / (download) - annotate - [select for diffs], Mon Nov 19 19:02:15 2001 UTC (22 years, 6 months ago) by mpech
Branch: MAIN
Changes since 1.8: +5 -5 lines
Diff to previous 1.8 (colored)

kill more registers

millert@ ok

Revision 1.8 / (download) - annotate - [select for diffs], Fri May 18 02:41:38 2001 UTC (23 years ago) by provos
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.7: +24 -16 lines
Diff to previous 1.7 (colored)

adapt to use pool

Revision 1.7 / (download) - annotate - [select for diffs], Sat Feb 27 21:22:19 1999 UTC (25 years, 2 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9, OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7, OPENBSD_2_6_BASE, OPENBSD_2_6, OPENBSD_2_5_BASE, OPENBSD_2_5
Changes since 1.6: +4 -3 lines
Diff to previous 1.6 (colored)

do not divide by zero; helbig@Informatik.BA-Stuttgart.DE

Revision 1.6 / (download) - annotate - [select for diffs], Wed Jul 23 02:50:55 1997 UTC (26 years, 10 months ago) by denny
Branch: MAIN
CVS Tags: OPENBSD_2_4_BASE, OPENBSD_2_4, OPENBSD_2_3_BASE, OPENBSD_2_3, OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.5: +17 -7 lines
Diff to previous 1.5 (colored)

Update for new <sys/mbuf.h>

Revision 1.5 / (download) - annotate - [select for diffs], Sun Jun 29 21:46:03 1997 UTC (26 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.4: +3 -2 lines
Diff to previous 1.4 (colored)

Use correct spacing on both 32bit and 64bit machines.

Revision 1.4 / (download) - annotate - [select for diffs], Sun Jun 29 20:18:01 1997 UTC (26 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.3: +6 -6 lines
Diff to previous 1.3 (colored)

Mostly clean -Wall + 64bit issues.

Revision 1.3 / (download) - annotate - [select for diffs], Wed Jun 26 05:37:23 1996 UTC (27 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_1_BASE, OPENBSD_2_1, OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.2: +2 -1 lines
Diff to previous 1.2 (colored)

rcsid

Revision 1.2 / (download) - annotate - [select for diffs], Fri May 10 13:02:35 1996 UTC (28 years ago) by deraadt
Branch: MAIN
Changes since 1.1: +6 -4 lines
Diff to previous 1.1 (colored)

if_name/if_unit -> if_xname/if_softc
network list is a TAILQ

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:45:51 1995 UTC (28 years, 7 months ago) by deraadt
CVS Tags: netbsd_1_1
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of NetBSD tree

Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 18 08:45:51 1995 UTC (28 years, 7 months ago) by deraadt
Branch: MAIN

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.