lmcconfig.c (239986) | lmcconfig.c (239988) |
---|---|
1/* 2 * First author: Michael Graff. 3 * Copyright (c) 1997-2000 Lan Media Corp. (www.lanmedia.com). 4 * All rights reserved. 5 * 6 * Second author: Andrew Stanley-Jones. 7 * Copyright (c) 2000-2002 SBE Corp. (www.sbei.com). 8 * All rights reserved. --- 48 unchanged lines hidden (view full) --- 57 * There is a man page for this program; go find it. 58 * 59 * If Netgraph is present (FreeBSD only): 60 * cc -o lmcconfig -l netgraph -D NETGRAPH lmcconfig.c 61 * If Netgraph is NOT present: 62 * cc -o lmcconfig lmcconfig.c 63 * Install the executable program in /usr/local/sbin/lmcconfig. 64 * | 1/* 2 * First author: Michael Graff. 3 * Copyright (c) 1997-2000 Lan Media Corp. (www.lanmedia.com). 4 * All rights reserved. 5 * 6 * Second author: Andrew Stanley-Jones. 7 * Copyright (c) 2000-2002 SBE Corp. (www.sbei.com). 8 * All rights reserved. --- 48 unchanged lines hidden (view full) --- 57 * There is a man page for this program; go find it. 58 * 59 * If Netgraph is present (FreeBSD only): 60 * cc -o lmcconfig -l netgraph -D NETGRAPH lmcconfig.c 61 * If Netgraph is NOT present: 62 * cc -o lmcconfig lmcconfig.c 63 * Install the executable program in /usr/local/sbin/lmcconfig. 64 * |
65 * $FreeBSD: head/usr.sbin/lmcconfig/lmcconfig.c 239986 2012-09-01 10:48:38Z ed $ | 65 * $FreeBSD: head/usr.sbin/lmcconfig/lmcconfig.c 239988 2012-09-01 10:56:15Z ed $ |
66 */ 67 68#include <sys/param.h> 69#include <sys/ioctl.h> 70#include <sys/socket.h> 71 72#include <errno.h> 73#include <inttypes.h> --- 995 unchanged lines hidden (view full) --- 1069 (mii16 & MII16_HSSI_LB) ? on : off, 1070 (mii16 & MII16_HSSI_LC) ? on : off, 1071 (mii16 & MII16_HSSI_TM) ? on : off); 1072} 1073 1074static void 1075print_events(void) 1076{ | 66 */ 67 68#include <sys/param.h> 69#include <sys/ioctl.h> 70#include <sys/socket.h> 71 72#include <errno.h> 73#include <inttypes.h> --- 995 unchanged lines hidden (view full) --- 1069 (mii16 & MII16_HSSI_LB) ? on : off, 1070 (mii16 & MII16_HSSI_LC) ? on : off, 1071 (mii16 & MII16_HSSI_TM) ? on : off); 1072} 1073 1074static void 1075print_events(void) 1076{ |
1077 char *time; 1078 struct timeval tv; | 1077 const char *reset_time; 1078 time_t now; |
1079 | 1079 |
1080 gettimeofday(&tv, NULL); 1081 time = (char *)ctime((time_t *)&tv); 1082 printf("Current time:\t\t%s", time); | 1080 now = time(NULL); 1081 printf("Current time:\t\t%s", ctime(&now)); |
1083 if (status.cntrs.reset_time.tv_sec < 1000) | 1082 if (status.cntrs.reset_time.tv_sec < 1000) |
1084 time = "Never\n"; | 1083 reset_time = "Never\n"; |
1085 else | 1084 else |
1086 time = (char *)ctime((time_t *)&status.cntrs.reset_time.tv_sec); 1087 printf("Cntrs reset:\t\t%s", time); | 1085 reset_time = ctime(&status.cntrs.reset_time.tv_sec); 1086 printf("Cntrs reset:\t\t%s", reset_time); |
1088 1089 if (status.cntrs.ibytes) printf("Rx bytes:\t\t%ju\n", (uintmax_t)status.cntrs.ibytes); 1090 if (status.cntrs.obytes) printf("Tx bytes:\t\t%ju\n", (uintmax_t)status.cntrs.obytes); 1091 if (status.cntrs.ipackets) printf("Rx packets:\t\t%ju\n", (uintmax_t)status.cntrs.ipackets); 1092 if (status.cntrs.opackets) printf("Tx packets:\t\t%ju\n", (uintmax_t)status.cntrs.opackets); 1093 if (status.cntrs.ierrors) printf("Rx errors:\t\t%u\n", status.cntrs.ierrors); 1094 if (status.cntrs.oerrors) printf("Tx errors:\t\t%u\n", status.cntrs.oerrors); 1095 if (status.cntrs.idiscards) printf("Rx discards:\t\t%u\n", status.cntrs.idiscards); --- 1459 unchanged lines hidden --- | 1087 1088 if (status.cntrs.ibytes) printf("Rx bytes:\t\t%ju\n", (uintmax_t)status.cntrs.ibytes); 1089 if (status.cntrs.obytes) printf("Tx bytes:\t\t%ju\n", (uintmax_t)status.cntrs.obytes); 1090 if (status.cntrs.ipackets) printf("Rx packets:\t\t%ju\n", (uintmax_t)status.cntrs.ipackets); 1091 if (status.cntrs.opackets) printf("Tx packets:\t\t%ju\n", (uintmax_t)status.cntrs.opackets); 1092 if (status.cntrs.ierrors) printf("Rx errors:\t\t%u\n", status.cntrs.ierrors); 1093 if (status.cntrs.oerrors) printf("Tx errors:\t\t%u\n", status.cntrs.oerrors); 1094 if (status.cntrs.idiscards) printf("Rx discards:\t\t%u\n", status.cntrs.idiscards); --- 1459 unchanged lines hidden --- |