Commit Graph

16 Commits

Author SHA1 Message Date
Dag-Erling Smørgrav
6bff85ff9a Reduce <sys/queue.h> pollution.
While <sys/sysctl.h> includes <sys/queue.h> unconditionally, it is only
actually used in code which is conditional on _KERNEL.  Make the #include
itself conditional as well, and fix userland code that uses <sys/queue.h>
for other purposes but relied on <sys/sysctl.h> to bring it in.

MFC after:	1 week
2018-05-11 00:01:43 +00:00
Pedro F. Giffuni
1de7b4b805 various: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
2017-11-27 15:37:16 +00:00
Ryan Stone
9daa89f3bb Fix integer truncation in affecting systat -ifstat
The "systat -ifstat" command was using a u_int to store byte counters.
With a 10Gbps or faster interface, this overflows within the default
5 second refresh period.  Switch to using a uint64_t across the board,
which matches the size used for all counters as of r263102.

PR:		182448
MFC after:	1 week
Sponsored by:	Sandvine Inc
2014-09-29 17:38:50 +00:00
Alexander V. Chernikov
6052df8ef8 Allow systat(1) interactive dispay-specific commands to
be specified via command line.

Submitted by:	vsevolod
MFC after:	2 weeks
2014-05-09 16:20:55 +00:00
Alexander V. Chernikov
297c1ec124 Fix several new & old style issues.
Pointed by:	ae, pluknet, zont
MFC with:	r247036
2013-02-20 14:19:09 +00:00
Alexander V. Chernikov
b021472399 Add interface name filtering via 'match' cmd.
Add 'pps' cmd for switching beetween interface packets/bytes statistics.

Submitted by:	vsevolod
MFC after:	2 weeks
2013-02-20 13:47:05 +00:00
Ed Schouten
902d9eafbf Rework all non-contributed files that use `struct timezone'.
This structure is not part of POSIX. According to POSIX, gettimeofday()
has the following prototype:

	int gettimeofday(struct timeval *restrict tp, void *restrict tzp);

Also, POSIX states that gettimeofday() shall return 0 (as long as tzp is
not used). Remove dead error handling code. Also use NULL for a
nul-pointer instead of integer 0.

While there, change all pieces of code that only use tv_sec to use
time(3), as this provides less overhead.
2012-09-01 14:45:15 +00:00
Ed Schouten
627d915e25 Whitespace fixes.
- Remove redundant empty lines.
- Replace ^L by \014. This allows you to safely cat/grep/etc this file
  without causing confusion.
2012-02-05 09:17:49 +00:00
Ed Schouten
2bd338d6c4 Fix whitespace inconsistencies in systat(1).
According to md5(1), the resulting binary is the same.
2011-10-15 13:20:36 +00:00
Xin LI
5abb148f43 - Handle the case where interface from "middle" is missing by
more carefully inspecting the return value from sysctl(3). [1]
 - Use calloc instead of malloc+memset of zero.

Submitted by:	Alexander Chernikov <admin su29 net> [1]
PR:		bin/119581
MFC after:	2 weeks
2008-01-12 00:11:26 +00:00
Yaroslav Tykhiy
2506efa78c Remove a wrong "const" qualifier.
Spotted by:	WARNS=6
2006-11-27 16:59:08 +00:00
Yaroslav Tykhiy
ce1bff762d Drop useless #includes. 2006-11-27 14:48:46 +00:00
Bruce Evans
a9a3dcd64f Remove trailing whitespace.
Submitted by:	Se=E1n Farley <sean-freebsd at farley dot org>
PR:		bin/81874
2006-04-30 04:47:23 +00:00
Bruce Evans
8aa22952a9 Show the load average in the tcp display (it was already shown, perhaps
not very usefully, in all other displays).  This was the original point
of the PR.

Move the load average up by 2 so that it starts in row 0 for all windows
(2 lines above it were wasted for all other windows except vmstat).
Move everything below it up by 2 or 3 (3 for icmp and icmp6 which had
an extra blank line due from not compensating for the foot-shooting in
note (3); only ip and ip6 compensated).  Reduce the magic numbers related
to this.

Notes by the submitter:
%%%
1. All the subwin() calls are identical using #define MAINWIN_ROW 3
    (systat.h).
2. The load average is at the top of the window.
3. Each display starts on the fourth line.  I made changes to those
    displays that shifted the start line (i.e., icmp).  This entailed a
    lot of changes within the comments at the top of those displays.
4. For ip6, I shifted the "Input next-header histogram" column down one
    row to separate it from "IPv6 Output".  I raised "bad scope packets"
    and "address selection failed" up one row to stay with "IPv6 Input"
    (valid?).  They were down one row to probably line up at the bottom,
    but I think they should stick with their fellow items in a column.
5. I condensed ifstat a bit.  It had a lot of empty rows.
%%%

Submitted by:	Se=E1n Farley <sean-freebsd at farley dot org>
PR:		bin/81874
2006-04-30 04:26:46 +00:00
David Malone
33dc549136 Fix the easy warnings:
1) Avoid shadowing index.
2) Constness.
3) Missing prototype for ifcmd.
4) Missing include of string.h.
5) Avoid shadowing error function.
6) ANSI definition for main.
2004-03-09 11:57:28 +00:00
Poul-Henning Kamp
b59ba7df87 Add "ifstat" display:
ifstat      Display the network traffic going through active interfaces
                 on the system.  Idle interfaces will not be displayed until
                 they receive some traffic.

                 For each interface being displayed, the current, peak and
                 total statistics are displayed for incoming and outgoing
                 traffic.  By default, the ifstat display will automatically
                 scale the units being used so that they are in a human-read-
                 able format.  The scaling units used for the current and peak
                 traffic columns can be altered by the scale command.

Submitted by:	Trent Nelson <trent@arpa.com>
2003-01-04 22:07:24 +00:00