From 552fc02595d525f9ca914ff5ace4401afeddd135 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Sun, 23 Mar 2008 19:46:49 +0000 Subject: [PATCH] Remove ipw(4) remains. --- Makefile_upgrade.inc | 5 +- sys/boot/forth/loader-bootp.conf | 3 +- sys/boot/forth/loader.conf | 3 +- usr.sbin/Makefile | 3 +- usr.sbin/ipwcontrol/Makefile | 8 - usr.sbin/ipwcontrol/ipwcontrol.8 | 98 -------- usr.sbin/ipwcontrol/ipwcontrol.c | 413 ------------------------------- 7 files changed, 7 insertions(+), 526 deletions(-) delete mode 100644 usr.sbin/ipwcontrol/Makefile delete mode 100644 usr.sbin/ipwcontrol/ipwcontrol.8 delete mode 100644 usr.sbin/ipwcontrol/ipwcontrol.c diff --git a/Makefile_upgrade.inc b/Makefile_upgrade.inc index 8371b5e82f..64cc93b748 100644 --- a/Makefile_upgrade.inc +++ b/Makefile_upgrade.inc @@ -1,4 +1,4 @@ -# $DragonFly: src/Makefile_upgrade.inc,v 1.17 2008/03/22 09:55:41 sephe Exp $ +# $DragonFly: src/Makefile_upgrade.inc,v 1.18 2008/03/23 19:46:48 swildner Exp $ # # Append all obsolete files to this file # Avoid constructs like {foo,bar}. It is parsed by /bin/sh @@ -565,3 +565,6 @@ TO_REMOVE+=/usr/share/groff_font/devlj4/text.map TO_REMOVE+=/modules/if_ipw.ko TO_REMOVE+=/usr/share/man/cat4/ipw.4.gz TO_REMOVE+=/usr/share/man/man4/ipw.4.gz +TO_REMOVE+=/usr/sbin/ipwcontrol +TO_REMOVE+=/usr/share/man/cat8/ipwcontrol.8.gz +TO_REMOVE+=/usr/share/man/man8/ipwcontrol.8.gz diff --git a/sys/boot/forth/loader-bootp.conf b/sys/boot/forth/loader-bootp.conf index ade4fd184d..08c80f5031 100644 --- a/sys/boot/forth/loader-bootp.conf +++ b/sys/boot/forth/loader-bootp.conf @@ -7,7 +7,7 @@ # All arguments must be in double quotes. # # $FreeBSD: src/sys/boot/forth/loader.conf,v 1.72 2003/07/01 01:03:32 brueffer Exp $ -# $DragonFly: src/sys/boot/forth/loader-bootp.conf,v 1.20 2008/03/09 10:55:14 swildner Exp $ +# $DragonFly: src/sys/boot/forth/loader-bootp.conf,v 1.21 2008/03/23 19:46:49 swildner Exp $ ############################################################## ### Basic configuration options ############################ @@ -196,7 +196,6 @@ if_et_load="NO" # Agere ET1310 10/100/Gigabit ethernet if_fwe_load="NO" # Ethernet emulation driver for FireWire if_fxp_load="NO" # Intel EtherExpress PRO/100B (82557, 82558) if_gx_load="NO" # Intel Pro/1000 gigabit ethernet -if_ipw_load="NO" # Intel(R) PRO/Wireless 2100 MiniPCI if_iwi_load="NO" # Intel(R) PRO/Wireless 2200BG/2915ABG MiniPCI if_iwl_load="NO" # Intel(R) PRO/Wireless 2100 MiniPCI if_lge_load="NO" # Level 1 LXT1001 NetCellerator PCI gigabit ethernet diff --git a/sys/boot/forth/loader.conf b/sys/boot/forth/loader.conf index 414bd211e0..10dc331a5f 100644 --- a/sys/boot/forth/loader.conf +++ b/sys/boot/forth/loader.conf @@ -7,7 +7,7 @@ # All arguments must be in double quotes. # # $FreeBSD: src/sys/boot/forth/loader.conf,v 1.72 2003/07/01 01:03:32 brueffer Exp $ -# $DragonFly: src/sys/boot/forth/loader.conf,v 1.27 2008/03/09 10:55:14 swildner Exp $ +# $DragonFly: src/sys/boot/forth/loader.conf,v 1.28 2008/03/23 19:46:49 swildner Exp $ ############################################################## ### Basic configuration options ############################ @@ -192,7 +192,6 @@ if_et_load="NO" # Agere ET1310 10/100/Gigabit ethernet if_fwe_load="NO" # Ethernet emulation driver for FireWire if_fxp_load="NO" # Intel EtherExpress PRO/100B (82557, 82558) if_gx_load="NO" # Intel Pro/1000 gigabit ethernet -if_ipw_load="NO" # Intel(R) PRO/Wireless 2100 MiniPCI if_iwi_load="NO" # Intel(R) PRO/Wireless 2200BG/2915ABG MiniPCI if_iwl_load="NO" # Intel(R) PRO/Wireless 2100 MiniPCI if_lge_load="NO" # Level 1 LXT1001 NetCellerator PCI gigabit ethernet diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index 2b5db8b6e0..4b881ecaf3 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -1,6 +1,6 @@ # From: @(#)Makefile 5.20 (Berkeley) 6/12/93 # $FreeBSD: src/usr.sbin/Makefile,v 1.183.2.14 2003/04/16 11:01:51 ru Exp $ -# $DragonFly: src/usr.sbin/Makefile,v 1.44 2008/02/08 14:06:25 hasso Exp $ +# $DragonFly: src/usr.sbin/Makefile,v 1.45 2008/03/23 19:46:49 swildner Exp $ .include "../sys/platform/${MACHINE_PLATFORM}/Makefile.inc" @@ -44,7 +44,6 @@ SUBDIR= 802_11 \ ifmcstat \ inetd \ iostat \ - ipwcontrol \ iwicontrol \ jail \ jexec \ diff --git a/usr.sbin/ipwcontrol/Makefile b/usr.sbin/ipwcontrol/Makefile deleted file mode 100644 index 48aabaff73..0000000000 --- a/usr.sbin/ipwcontrol/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# $DragonFly: src/usr.sbin/ipwcontrol/Attic/Makefile,v 1.1 2005/03/06 18:25:14 dillon Exp $ -# -PROG = ipwcontrol -MAN = ipwcontrol.8 - -WARNS?= 6 - -.include diff --git a/usr.sbin/ipwcontrol/ipwcontrol.8 b/usr.sbin/ipwcontrol/ipwcontrol.8 deleted file mode 100644 index b3aa46c801..0000000000 --- a/usr.sbin/ipwcontrol/ipwcontrol.8 +++ /dev/null @@ -1,98 +0,0 @@ -.\" Copyright (c) 2004, 2005 -.\" Damien Bergamini . All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice unmodified, this list of conditions, and the following -.\" disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: ipwcontrol.8,v 1.1.2.1 2005/01/13 20:01:05 damien Exp $ -.\" $DragonFly: src/usr.sbin/ipwcontrol/Attic/ipwcontrol.8,v 1.1 2005/03/06 18:25:14 dillon Exp $ -.\" -.Dd September 4, 2004 -.Os -.Dt IPWCONTROL 8 -.Sh NAME -.Nm ipwcontrol -.Nd configure Intel PRO/Wireless 2100 network adapter -.Sh SYNOPSIS -.Nm -.Op Fl i -.Ar iface -.Nm -.Op Fl i -.Ar iface Fl f Ar firmware -.Nm -.Op Fl i -.Ar iface Fl k -.Nm -.Op Fl i -.Ar iface Fl r -.Sh DESCRIPTION -The -.Nm -utility controls the operation of Intel PRO/Wireless 2100 networking -devices via -.Xr ipw 4 -driver. -.Pp -You should not use this program to configure IEEE 802.11 parameters. -Use -.Xr ifconfig 8 -instead. -.Sh OPTIONS -The options are as follows: -.Bl -tag -width indent -.It Oo Fl i Oc Ar iface -Display adapter's internal statistics. -.It Oo Fl i Oc Ar iface Fl f Ar firmware -Download firmware binary image -.Ar firmware -to the driver. -.It Oo Fl i Oc Ar iface Fl k -Kill (remove) the firmware and reset the adapter. -.It Oo Fl i Oc Ar iface Fl r -Display the radio switch state (on or off). -.El -.Sh FILES -The firmware is not shipped with -.Fx ; -install the -.Pa ipw-firmware -package. -The original archive is available from Intel at: -.Pa http://ipw2100.sourceforge.net/firmware.php?fid=3 . -.Pp -.Bl -tag -width ipw2100-1.2-i.fw -compact -.It Pa ipw2100-1.2.fw -BSS mode (connection to an access point) firmware -.It Pa ipw2100-1.2-i.fw -IBSS mode (point-to-point connection) firmware -.It Pa ipw2100-1.2-p.fw -Monitor mode firmware -.El -.Sh SEE ALSO -.Xr ipw 4 , -.Xr ifconfig 8 -.Sh AUTHORS -The -.Nm -utility and this man page were written by -.An Damien Bergamini Aq damien.bergamini@free.fr . diff --git a/usr.sbin/ipwcontrol/ipwcontrol.c b/usr.sbin/ipwcontrol/ipwcontrol.c deleted file mode 100644 index b0474ba560..0000000000 --- a/usr.sbin/ipwcontrol/ipwcontrol.c +++ /dev/null @@ -1,413 +0,0 @@ -/*- - * Copyright (c) 2004, 2005 - * Damien Bergamini . All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice unmodified, this list of conditions, and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: ipwcontrol.c,v 1.5.2.1 2005/01/13 20:01:05 damien Exp $ - * $DragonFly: src/usr.sbin/ipwcontrol/Attic/ipwcontrol.c,v 1.3 2005/12/05 01:04:01 swildner Exp $ - */ - -#include - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#define SIOCSLOADFW _IOW('i', 137, struct ifreq) -#define SIOCSKILLFW _IOW('i', 138, struct ifreq) - -static void usage(void); -static int do_req(const char *, unsigned long, void *); -static void load_firmware(const char *, const char *); -static void kill_firmware(const char *); -static void get_radio_state(const char *); -static void get_statistics(const char *); - -int -main(int argc, char **argv) -{ - int ch; - const char *iface; - - opterr = 0; - ch = getopt(argc, argv, "i:"); - if (ch == 'i') { - iface = optarg; - } else { - if (argc > 1 && argv[1][0] != '-') { - iface = argv[1]; - optind = 2; - } else { - iface = "ipw0"; - optind = 1; - } - optreset = 1; - } - opterr = 1; - - while ((ch = getopt(argc, argv, "f:kr")) != -1) { - switch (ch) { - case 'f': - load_firmware(iface, optarg); - return EX_OK; - - case 'k': - kill_firmware(iface); - return EX_OK; - - case 'r': - get_radio_state(iface); - return EX_OK; - - default: - usage(); - } - } - - get_statistics(iface); - - return EX_OK; -} - -extern char *__progname; - -static void -usage(void) -{ - fprintf(stderr, "usage: %s -i iface\n" - "\t%s -i iface -f firmware\n" - "\t%s -i iface -k\n" - "\t%s -i iface -r\n", __progname, __progname, __progname, - __progname); - - exit(EX_USAGE); -} - -static int -do_req(const char *iface, unsigned long req, void *data) -{ - int s; - struct ifreq ifr; - int error; - - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1) - err(EX_OSERR, "Can't create socket"); - - memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name)); - ifr.ifr_data = data; - error = ioctl(s, req, &ifr); - - close(s); - - return error; -} - -static void -load_firmware(const char *iface, const char *firmware) -{ - int fd; - struct stat st; - void *map; - - if ((fd = open(firmware, O_RDONLY)) == -1) - err(EX_OSERR, "%s", firmware); - - if (fstat(fd, &st) == -1) - err(EX_OSERR, "Unable to stat %s", firmware); - - if ((map = mmap(NULL, st.st_size, PROT_READ, 0, fd, 0)) == NULL) - err(EX_OSERR, "Can't map %s into memory", firmware); - - if (do_req(iface, SIOCSLOADFW, map) == -1) - err(EX_OSERR, "Can't load %s to driver", firmware); - - munmap(map, st.st_size); - close(fd); -} - -static void -kill_firmware(const char *iface) -{ - if (do_req(iface, SIOCSKILLFW, NULL) == -1) - err(EX_OSERR, "Can't kill firmware"); -} - -static void -get_radio_state(const char *iface) -{ - int radio, len; - char sysctl_name[24]; - - len = snprintf(sysctl_name, sizeof(sysctl_name), "hw.%s.radio", iface); - if (len == -1 || len > (int)sizeof(sysctl_name)) - err(EX_OSERR, "Could not get radio transmitter state"); - - len = sizeof radio; - if (sysctlbyname(sysctl_name, &radio, &len, NULL, 0) == -1) - err(EX_OSERR, "Could not get radio transmitter state"); - - printf("Radio is %s\n", radio ? "ON" : "OFF"); -} - -struct statistic { - int index; - const char *desc; - int unit; -#define INT 1 -#define HEX 2 -#define MASK HEX -#define PERCENTAGE 3 -#define BOOL 4 -}; - -/*- - * TIM = Traffic Information Message - * DTIM = Delivery TIM - * ATIM = Announcement TIM - * PSP = Power Save Poll - * RTS = Request To Send - * CTS = Clear To Send - * RSSI = Received Signal Strength Indicator - */ - -static const struct statistic tbl[] = { - { 1, "Number of frames submitted for transfer", INT }, - { 2, "Number of frames transmitted", INT }, - { 3, "Number of unicast frames transmitted", INT }, - { 4, "Number of unicast frames transmitted at 1Mb/s", INT }, - { 5, "Number of unicast frames transmitted at 2Mb/s", INT }, - { 6, "Number of unicast frames transmitted at 5.5Mb/s", INT }, - { 7, "Number of unicast frames transmitted at 11Mb/s", INT }, - - { 13, "Number of multicast frames transmitted at 1Mb/s", INT }, - { 14, "Number of multicast frames transmitted at 2Mb/s", INT }, - { 15, "Number of multicast frames transmitted at 5.5Mb/s", INT }, - { 16, "Number of multicast frames transmitted at 11Mb/s", INT }, - - { 21, "Number of null frames transmitted", INT }, - { 22, "Number of RTS frames transmitted", INT }, - { 23, "Number of CTS frames transmitted", INT }, - { 24, "Number of ACK frames transmitted", INT }, - { 25, "Number of association requests transmitted", INT }, - { 26, "Number of association responses transmitted", INT }, - { 27, "Number of reassociation requests transmitted", INT }, - { 28, "Number of reassociation responses transmitted", INT }, - { 29, "Number of probe requests transmitted", INT }, - { 30, "Number of probe reponses transmitted", INT }, - { 31, "Number of beacons transmitted", INT }, - { 32, "Number of ATIM frames transmitted", INT }, - { 33, "Number of disassociation requests transmitted", INT }, - { 34, "Number of authentication requests transmitted", INT }, - { 35, "Number of deauthentication requests transmitted", INT }, - - { 41, "Number of bytes transmitted", INT }, - { 42, "Number of transmission retries", INT }, - { 43, "Number of transmission retries at 1Mb/s", INT }, - { 44, "Number of transmission retries at 2Mb/s", INT }, - { 45, "Number of transmission retries at 5.5Mb/s", INT }, - { 46, "Number of transmission retries at 11Mb/s", INT }, - - { 51, "Number of transmission failures", INT }, - - { 54, "Number of transmission aborted due to DMA", INT }, - - { 56, "Number of disassociation failures", INT }, - - { 58, "Number of spanning tree frames transmitted", INT }, - { 59, "Number of transmission errors due to missing ACK", INT }, - - { 61, "Number of frames received", INT }, - { 62, "Number of unicast frames received", INT }, - { 63, "Number of unicast frames received at 1Mb/s", INT }, - { 64, "Number of unicast frames received at 2Mb/s", INT }, - { 65, "Number of unicast frames received at 5.5Mb/s", INT }, - { 66, "Number of unicast frames received at 11Mb/s", INT }, - - { 71, "Number of multicast frames received", INT }, - { 72, "Number of multicast frames received at 1Mb/s", INT }, - { 73, "Number of multicast frames received at 2Mb/s", INT }, - { 74, "Number of multicast frames received at 5.5Mb/s", INT }, - { 75, "Number of multicast frames received at 11Mb/s", INT }, - - { 80, "Number of null frames received", INT }, - { 81, "Number of poll frames received", INT }, - { 82, "Number of RTS frames received", INT }, - { 83, "Number of CTS frames received", INT }, - { 84, "Number of ACK frames received", INT }, - { 85, "Number of CF-End frames received", INT }, - { 86, "Number of CF-End + CF-Ack frames received", INT }, - { 87, "Number of association requests received", INT }, - { 88, "Number of association responses received", INT }, - { 89, "Number of reassociation requests received", INT }, - { 90, "Number of reassociation responses received", INT }, - { 91, "Number of probe requests received", INT }, - { 92, "Number of probe reponses received", INT }, - { 93, "Number of beacons received", INT }, - { 94, "Number of ATIM frames received", INT }, - { 95, "Number of disassociation requests received", INT }, - { 96, "Number of authentication requests received", INT }, - { 97, "Number of deauthentication requests received", INT }, - - { 101, "Number of bytes received", INT }, - { 102, "Number of frames with a bad CRC received", INT }, - { 103, "Number of frames with a bad CRC received at 1Mb/s", INT }, - { 104, "Number of frames with a bad CRC received at 2Mb/s", INT }, - { 105, "Number of frames with a bad CRC received at 5.5Mb/s", INT }, - { 106, "Number of frames with a bad CRC received at 11Mb/s", INT }, - - { 112, "Number of duplicated frames received at 1Mb/s", INT }, - { 113, "Number of duplicated frames received at 2Mb/s", INT }, - { 114, "Number of duplicated frames received at 5.5Mb/s", INT }, - { 115, "Number of duplicated frames received at 11Mb/s", INT }, - - { 119, "Number of duplicated frames received", INT }, - - { 123, "Number of frames with a bad protocol received", INT }, - { 124, "Boot time", INT }, - { 125, "Number of frames dropped due to missing buffer", INT }, - { 126, "Number of frames dropped due to DMA", INT }, - - { 128, "Number of frames dropped due to missing fragment", INT }, - { 129, "Number of frames dropped due to non-seq fragment", INT }, - { 130, "Number of frames dropped due to missing first frame", INT }, - { 131, "Number of frames dropped due to uncompleted frame", INT }, - - { 137, "Number of times adapter suspended", INT }, - { 138, "Beacon timeout", INT }, - { 139, "Number of poll response timeouts", INT }, - - { 141, "Number of PSP DTIM frames received", INT }, - { 142, "Number of PSP TIM frames received", INT }, - { 143, "PSP station Id", INT }, - - { 147, "RTC time of last association", INT }, - { 148, "Percentage of missed beacons", PERCENTAGE }, - { 149, "Percentage of missed transmission retries", PERCENTAGE }, - - { 151, "Number of access points in access points table", INT }, - - { 153, "Number of associations", INT }, - { 154, "Number of association failures", INT }, - { 156, "Number of full scans", INT }, - { 157, "Card disabled", BOOL }, - - { 160, "RSSI at time of association", INT }, - { 161, "Number of reassociations due to no probe response", INT }, - { 162, "Number of reassociations due to poor line quality", INT }, - { 163, "Number of reassociations due to load", INT }, - { 164, "Number of reassociations due to access point RSSI level", INT }, - { 165, "Number of reassociations due to load leveling", INT }, - - { 170, "Number of times authentication failed", INT }, - { 171, "Number of times authentication response failed", INT }, - { 172, "Number of entries in association table", INT }, - { 173, "Average RSSI", INT }, - - { 176, "Self test status", INT }, - { 177, "Power mode", INT }, - { 178, "Power index", INT }, - { 179, "IEEE country code", HEX }, - { 180, "Channels supported for this country", MASK }, - { 181, "Number of adapter warm resets", INT }, - { 182, "Beacon interval", INT }, - - { 184, "Princeton version", INT }, - { 185, "Antenna diversity disabled", BOOL }, - { 186, "CCA RSSI", INT }, - { 187, "Number of times EEPROM updated", INT }, - { 188, "Beacon intervals between DTIM", INT }, - { 189, "Current channel", INT }, - { 190, "RTC time", INT }, - { 191, "Operating mode", INT }, - { 192, "Transmission rate", HEX }, - { 193, "Supported transmission rates", MASK }, - { 194, "ATIM window", INT }, - { 195, "Supported basic transmission rates", MASK }, - { 196, "Adapter highest rate", HEX }, - { 197, "Access point highest rate", HEX }, - { 198, "Management frame capability", BOOL }, - { 199, "Type of authentication", INT }, - { 200, "Adapter card platform type", INT }, - { 201, "RTS threshold", INT }, - { 202, "International mode", BOOL }, - { 203, "Fragmentation threshold", INT }, - - { 213, "Microcode version", INT }, - - { 0, NULL, 0 } -}; - -static void -get_statistics(const char *iface) -{ - static u_int32_t stats[256]; - const struct statistic *st; - int len; - char sysctl_name[24]; - - len = snprintf(sysctl_name, sizeof(sysctl_name), "hw.%s.stats", iface); - if (len == -1 || len > (int)sizeof(sysctl_name)) - err(EX_OSERR, "Can't retrieve statistics"); - - len = sizeof stats; - if (sysctlbyname(sysctl_name, stats, &len, NULL, 0) == -1) - err(EX_OSERR, "Can't retrieve statistics"); - - for (st = tbl; st->index != 0; st++) { - printf("%-60s[", st->desc); - switch (st->unit) { - case INT: - printf("%u", stats[st->index]); - break; - - case BOOL: - printf(stats[st->index] ? "true" : "false"); - break; - - case PERCENTAGE: - printf("%u%%", stats[st->index]); - break; - - case HEX: - default: - printf("0x%08X", stats[st->index]); - } - printf("]\n"); - } -} -- 2.41.0