Changeset View
Changeset View
Standalone View
Standalone View
head/usr.bin/systat/icmp6.c
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <sys/socket.h> | #include <sys/socket.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <netinet/in.h> | #include <netinet/in.h> | ||||
#include <netinet/icmp6.h> | #include <netinet/icmp6.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" | ||||
static struct icmp6stat icmp6stat, initstat, oldstat; | static struct icmp6stat icmp6stat, initstat, oldstat; | ||||
▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | #define DO(stat) ret->stat = (icmp6stat.stat - sub->stat) / divisor | ||||
} | } | ||||
#undef DO | #undef DO | ||||
} | } | ||||
void | void | ||||
showicmp6(void) | showicmp6(void) | ||||
{ | { | ||||
struct icmp6stat stats; | struct icmp6stat stats; | ||||
u_long totalin, totalout; | uint64_t totalin, totalout; | ||||
int i; | int i; | ||||
memset(&stats, 0, sizeof stats); | memset(&stats, 0, sizeof stats); | ||||
domode(&stats); | domode(&stats); | ||||
for (i = totalin = totalout = 0; i <= ICMP6_MAXTYPE; i++) { | for (i = totalin = totalout = 0; i <= ICMP6_MAXTYPE; i++) { | ||||
totalin += stats.icp6s_inhist[i]; | totalin += stats.icp6s_inhist[i]; | ||||
totalout += stats.icp6s_outhist[i]; | totalout += stats.icp6s_outhist[i]; | ||||
} | } | ||||
totalin += stats.icp6s_badcode + stats.icp6s_badlen + | totalin += stats.icp6s_badcode + stats.icp6s_badlen + | ||||
stats.icp6s_checksum + stats.icp6s_tooshort; | stats.icp6s_checksum + stats.icp6s_tooshort; | ||||
mvwprintw(wnd, 1, 0, "%9lu", totalin); | mvwprintw(wnd, 1, 0, "%9"PRIu64, totalin); | ||||
mvwprintw(wnd, 1, 35, "%9lu", totalout); | mvwprintw(wnd, 1, 35, "%9"PRIu64, totalout); | ||||
#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(icp6s_badcode, 2, 0); | DO(icp6s_badcode, 2, 0); | ||||
DO(icp6s_badlen, 3, 0); | DO(icp6s_badlen, 3, 0); | ||||
DO(icp6s_checksum, 4, 0); | DO(icp6s_checksum, 4, 0); | ||||
DO(icp6s_tooshort, 5, 0); | DO(icp6s_tooshort, 5, 0); | ||||
DO(icp6s_error, 2, 35); | DO(icp6s_error, 2, 35); | ||||
DO(icp6s_tooshort, 3, 35); | DO(icp6s_tooshort, 3, 35); | ||||
DO(icp6s_canterror, 4, 35); | DO(icp6s_canterror, 4, 35); | ||||
▲ Show 20 Lines • Show All 81 Lines • Show Last 20 Lines |