Deleted Added
sdiff udiff text old ( 247037 ) new ( 265782 )
full compact
1/*
2 * Copyright (c) 2003, Trent Nelson, <trent@arpa.com>.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTIFSTAT_ERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD: head/usr.bin/systat/ifstat.c 247037 2013-02-20 14:19:09Z melifaro $
29 */
30
31#include <sys/types.h>
32#include <sys/socket.h>
33#include <sys/sysctl.h>
34#include <net/if.h>
35#include <net/if_mib.h>
36

--- 35 unchanged lines hidden (view full) ---

72 u_long if_out_curtraffic;
73 u_long if_in_traffic_peak;
74 u_long if_out_traffic_peak;
75 u_long if_in_curpps;
76 u_long if_out_curpps;
77 u_long if_in_pps_peak;
78 u_long if_out_pps_peak;
79 u_int if_row; /* Index into ifmib sysctl */
80 u_int if_ypos; /* 0 if not being displayed */
81 u_int display;
82 u_int match;
83};
84
85extern int curscale;
86extern char *matchline;
87extern int showpps;
88extern int needsort;

--- 116 unchanged lines hidden (view full) ---

205}
206
207void
208showifstat(void)
209{
210 struct if_stat *ifp = NULL;
211
212 SLIST_FOREACH(ifp, &curlist, link) {
213 if (ifp->display == 0 || (ifp->match == 0) ||
214 ifp->if_ypos > LINES - 3 - 1)
215 continue;
216 PUTNAME(ifp);
217 PUTRATE(col2, ifp->if_ypos);
218 PUTRATE(col3, ifp->if_ypos);
219 PUTTOTAL(col4, ifp->if_ypos);
220 }
221
222 return;
223}
224
225int
226initifstat(void)
227{

--- 192 unchanged lines hidden (view full) ---

420 if (matchline && !check_match(ifp->if_mib.ifmd_name))
421 ifp->match = 0;
422 else
423 ifp->match = 1;
424 if (ifp->display && ifp->match) {
425 ifp->if_ypos = y;
426 y += ROW_SPACING;
427 }
428 }
429
430 needsort = 0;
431 needclear = 1;
432}
433
434static
435unsigned int

--- 35 unchanged lines hidden (view full) ---

471int
472cmdifstat(const char *cmd, const char *args)
473{
474 int retval = 0;
475
476 retval = ifcmd(cmd, args);
477 /* ifcmd() returns 1 on success */
478 if (retval == 1) {
479 showifstat();
480 refresh();
481 if (needclear) {
482 werase(wnd);
483 labelifstat();
484 needclear = 0;
485 }
486 }
487
488 return (retval);
489}