NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/51204: add



>Number:         51204
>Category:       bin
>Synopsis:       add
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue May 31 15:20:00 +0000 2016
>Originator:     scole_mail
>Release:        7.0.1
>Organization:
none
>Environment:
NetBSD dstar 7.0.1_PATCH NetBSD 7.0.1_PATCH (GENERIC) #0: Sat May 28 11:24:19 EDT 2016  scole@dstar:/home/scole/nbsd/7_0/obj/sys/arch/i386/compile/GENERIC i386
>Description:
I ported the ifstat part of systat from freebsd 10.1.  This displays
network traffic statistics for active interfaces in a curses window.
Here is a screen shot:

shell> systat -w 1 ifstat


                    /0   /1   /2   /3   /4   /5   /6   /7   /8   /9   /10
     Load Average

      Interface           Traffic               Peak                Total
            lo0  in      0.054 KB/s          0.221 KB/s          111.380 KB
                 out     0.054 KB/s          0.221 KB/s          111.380 KB

          athn0  in     22.062 KB/s         27.065 KB/s           47.030 MB
                 out    22.003 KB/s         26.978 KB/s           34.109 MB

            re1  in      0.000 KB/s          0.000 KB/s            1.111 KB
                 out     0.000 KB/s          0.000 KB/s            0.494 KB

            re0  in     50.894 KB/s         51.068 KB/s          797.001 KB
                 out    50.894 KB/s         51.040 KB/s          787.297 KB


To get interface information, I wasn't sure which method to use from
sysctl/prog_sysctl/kvm.  So I used getifaddrs/freeifaddrs which seemed
the simplest to understand and code.

If new interfaces are added while running, the code handles that
automagically and will add them to the display.  If any interfaces are
removed, then it display an error message and exit.  I didn't see a
clean way around that, as you can just restart the gui and that
shouldn't be a common occurrence I would think.

These patches apply to current, but they worked on 7.0.1 fine.

Feel free to change these changes...

new files copied from freebsd:
	convtbl.c	(unchanged)
	convtbl.h	(unchanged)
	ifcmds.c	(unchanged)
	ifstat.c	(modified for netbsd)

modified:
	Makefile
	cmds.c
	cmdtab.c
	extern.h
	systat.1

Thanks

>How-To-Repeat:
systat -w 1 ifstat
>Fix:



Home | Main Index | Thread Index | Old Index