Changeset View
Changeset View
Standalone View
Standalone View
head/usr.bin/systat/ip.c
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | |||||
#include <netinet/in.h> | #include <netinet/in.h> | ||||
#include <netinet/in_systm.h> | #include <netinet/in_systm.h> | ||||
#include <netinet/ip.h> | #include <netinet/ip.h> | ||||
#include <netinet/ip_var.h> | #include <netinet/ip_var.h> | ||||
#include <netinet/udp.h> | #include <netinet/udp.h> | ||||
#include <netinet/udp_var.h> | #include <netinet/udp_var.h> | ||||
#include <inttypes.h> | |||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <paths.h> | #include <paths.h> | ||||
#include "systat.h" | #include "systat.h" | ||||
#include "extern.h" | #include "extern.h" | ||||
#include "mode.h" | #include "mode.h" | ||||
▲ Show 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | #define DO(stat) ret->stat = (curstat.stat - sub->stat) / divisor | ||||
DO(u.udps_opackets); | DO(u.udps_opackets); | ||||
#undef DO | #undef DO | ||||
} | } | ||||
void | void | ||||
showip(void) | showip(void) | ||||
{ | { | ||||
struct stat stats; | struct stat stats; | ||||
u_long totalout; | uint64_t totalout; | ||||
domode(&stats); | domode(&stats); | ||||
totalout = stats.i.ips_forward + stats.i.ips_localout; | totalout = stats.i.ips_forward + stats.i.ips_localout; | ||||
#define DO(stat, row, col) \ | #define DO(stat, row, col) \ | ||||
mvwprintw(wnd, row, col, "%9lu", stats.stat) | mvwprintw(wnd, row, col, "%9"PRIu64, stats.stat) | ||||
DO(i.ips_total, 1, 0); | DO(i.ips_total, 1, 0); | ||||
mvwprintw(wnd, 1, 35, "%9lu", totalout); | mvwprintw(wnd, 1, 35, "%9"PRIu64, totalout); | ||||
DO(i.ips_badsum, 2, 0); | DO(i.ips_badsum, 2, 0); | ||||
DO(i.ips_localout, 2, 35); | DO(i.ips_localout, 2, 35); | ||||
DO(i.ips_tooshort, 3, 0); | DO(i.ips_tooshort, 3, 0); | ||||
DO(i.ips_odropped, 3, 35); | DO(i.ips_odropped, 3, 35); | ||||
DO(i.ips_toosmall, 4, 0); | DO(i.ips_toosmall, 4, 0); | ||||
DO(i.ips_ofragments, 4, 35); | DO(i.ips_ofragments, 4, 35); | ||||
DO(i.ips_badhlen, 5, 0); | DO(i.ips_badhlen, 5, 0); | ||||
DO(i.ips_cantfrag, 5, 35); | DO(i.ips_cantfrag, 5, 35); | ||||
▲ Show 20 Lines • Show All 118 Lines • Show Last 20 Lines |