static void io_display(char *name, vopstats_t *oldvsp, vopstats_t *newvsp, int dispflag) { int niceflag = ((dispflag & DISP_RAW) == 0); char buf[LBUFSZ]; if (dispflag & DISP_HEADER) { (void) printf( " read read write write rddir rddir rwlock rwulock\n" " ops bytes ops bytes ops bytes ops ops\n"); } PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nread), buf); PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(read_bytes), buf); PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nwrite), buf); PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(write_bytes), buf); PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nreaddir), buf); PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(readdir_bytes), buf); PRINTSTAT(niceflag, " %5s ", "%lld:", DELTA(nrwlock), buf); PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nrwunlock), buf); (void) printf("%s\n", name); }
static void attr_display(char *name, vopstats_t *oldvsp, vopstats_t *newvsp, int dispflag) { int niceflag = ((dispflag & DISP_RAW) == 0); char buf[LBUFSZ]; if (dispflag & DISP_HEADER) { (void) printf("getattr setattr getsec setsec\n"); } PRINTSTAT(niceflag, " %5s ", "%lld:", DELTA(ngetattr), buf); PRINTSTAT(niceflag, " %5s ", "%lld:", DELTA(nsetattr), buf); PRINTSTAT(niceflag, " %5s ", "%lld:", DELTA(ngetsecattr), buf); PRINTSTAT(niceflag, " %5s ", "%lld:", DELTA(nsetsecattr), buf); (void) printf("%s\n", name); }
static void naming_display(char *name, vopstats_t *oldvsp, vopstats_t *newvsp, int dispflag) { int niceflag = ((dispflag & DISP_RAW) == 0); char buf[LBUFSZ]; if (dispflag & DISP_HEADER) { (void) printf( "lookup creat remov link renam mkdir rmdir rddir symlnk rdlnk\n"); } PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nlookup), buf); PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(ncreate), buf); PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nremove), buf); PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nlink), buf); PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nrename), buf); PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nmkdir), buf); PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nrmdir), buf); PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nreaddir), buf); PRINTSTAT(niceflag, " %5s ", "%lld:", DELTA(nsymlink), buf); PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nreadlink), buf); (void) printf("%s\n", name); }
static void vm_display(char *name, vopstats_t *oldvsp, vopstats_t *newvsp, int dispflag) { int niceflag = ((dispflag & DISP_RAW) == 0); char buf[LBUFSZ]; if (dispflag & DISP_HEADER) { (void) printf(" map addmap delmap getpag putpag pagio\n"); } PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nmap), buf); PRINTSTAT(niceflag, " %5s ", "%lld:", DELTA(naddmap), buf); PRINTSTAT(niceflag, " %5s ", "%lld:", DELTA(ndelmap), buf); PRINTSTAT(niceflag, " %5s ", "%lld:", DELTA(ngetpage), buf); PRINTSTAT(niceflag, " %5s ", "%lld:", DELTA(nputpage), buf); PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(npageio), buf); (void) printf("%s\n", name); }
static void dflt_display(char *name, vopstats_t *oldvsp, vopstats_t *newvsp, int dispflag) { int niceflag = ((dispflag & DISP_RAW) == 0); longlong_t nnewfile; longlong_t nnamerm; longlong_t nnamechg; longlong_t nattrret; longlong_t nattrchg; longlong_t nlookup; longlong_t nreaddir; longlong_t ndataread; longlong_t ndatawrite; longlong_t readthruput; longlong_t writethruput; char buf[LBUFSZ]; nnewfile = DELTA(ncreate) + DELTA(nmkdir) + DELTA(nsymlink); nnamerm = DELTA(nremove) + DELTA(nrmdir); nnamechg = DELTA(nrename) + DELTA(nlink) + DELTA(nsymlink); nattrret = DELTA(ngetattr) + DELTA(naccess) + DELTA(ngetsecattr) + DELTA(nfid); nattrchg = DELTA(nsetattr) + DELTA(nsetsecattr) + DELTA(nspace); nlookup = DELTA(nlookup); nreaddir = DELTA(nreaddir); ndataread = DELTA(nread); ndatawrite = DELTA(nwrite); readthruput = DELTA(read_bytes); writethruput = DELTA(write_bytes); if (dispflag & DISP_HEADER) { (void) printf( " new name name attr attr lookup rddir read read write write\n" " file remov chng get set ops ops ops bytes ops bytes\n"); } PRINTSTAT(niceflag, "%5s ", "%lld:", nnewfile, buf); PRINTSTAT(niceflag, "%5s ", "%lld:", nnamerm, buf); PRINTSTAT(niceflag, "%5s ", "%lld:", nnamechg, buf); PRINTSTAT(niceflag, "%5s ", "%lld:", nattrret, buf); PRINTSTAT(niceflag, "%5s ", "%lld:", nattrchg, buf); PRINTSTAT(niceflag, " %5s ", "%lld:", nlookup, buf); PRINTSTAT(niceflag, "%5s ", "%lld:", nreaddir, buf); PRINTSTAT(niceflag, "%5s ", "%lld:", ndataread, buf); PRINTSTAT(niceflag, "%5s ", "%lld:", readthruput, buf); PRINTSTAT(niceflag, "%5s ", "%lld:", ndatawrite, buf); PRINTSTAT(niceflag, "%5s ", "%lld:", writethruput, buf); (void) printf("%s\n", name); }
long w_ifstat(Ether* ether, void* a, long n, ulong offset) { Ctlr *ctlr = (Ctlr*) ether->ctlr; char *k, *p; int i, l, txid; ether->oerrs = ctlr->ntxerr; ether->crcs = ctlr->nrxfcserr; ether->frames = 0; ether->buffs = ctlr->nrxdropnobuf; ether->overflows = 0; // // Offset must be zero or there's a possibility the // new data won't match the previous read. // if(n == 0 || offset != 0) return 0; p = smalloc(READSTR); l = 0; PRINTSTAT("Signal: %d\n", ctlr->signal-149); PRINTSTAT("Noise: %d\n", ctlr->noise-149); PRINTSTAT("SNR: %ud\n", ctlr->signal-ctlr->noise); PRINTSTAT("Interrupts: %lud\n", ctlr->nints); PRINTSTAT("Double Interrupts: %lud\n", ctlr->ndoubleint); PRINTSTAT("TxPackets: %lud\n", ctlr->ntx); PRINTSTAT("RxPackets: %lud\n", ctlr->nrx); PRINTSTAT("TxErrors: %lud\n", ctlr->ntxerr); PRINTSTAT("RxErrors: %lud\n", ctlr->nrxerr); PRINTSTAT("TxRequests: %lud\n", ctlr->ntxrq); PRINTSTAT("AllocEvs: %lud\n", ctlr->nalloc); PRINTSTAT("InfoEvs: %lud\n", ctlr->ninfo); PRINTSTAT("InfoDrop: %lud\n", ctlr->nidrop); PRINTSTAT("WatchDogs: %lud\n", ctlr->nwatchdogs); PRINTSTAT("Ticks: %ud\n", ctlr->ticks); PRINTSTAT("TickIntr: %ud\n", ctlr->tickintr); k = ((ctlr->state & Attached) ? "attached" : "not attached"); PRINTSTAT("Card %s", k); k = ((ctlr->state & Power) ? "on" : "off"); PRINTSTAT(", power %s", k); k = ((ctlr->txbusy)? ", txbusy" : ""); PRINTSTAT("%s\n", k); if(ctlr->hascrypt){ PRINTSTR("Keys: "); for (i = 0; i < WNKeys; i++){ if(ctlr->keys.keys[i].len == 0) PRINTSTR("none "); else if(SEEKEYS == 0) PRINTSTR("set "); else PRINTSTAT("%s ", ctlr->keys.keys[i].dat); } PRINTSTR("\n"); } // real card stats ilock(ctlr); PRINTSTR("\nCard stats: \n"); PRINTSTAT("Status: %ux\n", csr_ins(ctlr, WR_Sts)); PRINTSTAT("Event status: %ux\n", csr_ins(ctlr, WR_EvSts)); i = ltv_ins(ctlr, WTyp_Ptype); PRINTSTAT("Port type: %d\n", i); PRINTSTAT("Transmit rate: %d\n", ltv_ins(ctlr, WTyp_TxRate)); PRINTSTAT("Current Transmit rate: %d\n", ltv_ins(ctlr, WTyp_CurTxRate)); PRINTSTAT("Channel: %d\n", ltv_ins(ctlr, WTyp_Chan)); PRINTSTAT("AP density: %d\n", ltv_ins(ctlr, WTyp_ApDens)); PRINTSTAT("Promiscuous mode: %d\n", ltv_ins(ctlr, WTyp_Prom)); if(i == WPTypeAdHoc) PRINTSTAT("SSID name: %s\n", ltv_inname(ctlr, WTyp_NetName)); else { Wltv ltv; PRINTSTAT("Current name: %s\n", ltv_inname(ctlr, WTyp_CurName)); ltv.type = WTyp_BaseID; ltv.len = 4; if(w_inltv(ctlr, <v)) print("#l%d: unable to read base station mac addr\n", ether->ctlrno); l += snprint(p+l, READSTR-l, "Base station: %2.2x%2.2x%2.2x%2.2x%2.2x%2.2x\n", ltv.addr[0], ltv.addr[1], ltv.addr[2], ltv.addr[3], ltv.addr[4], ltv.addr[5]); } PRINTSTAT("Net name: %s\n", ltv_inname(ctlr, WTyp_WantName)); PRINTSTAT("Node name: %s\n", ltv_inname(ctlr, WTyp_NodeName)); if(ltv_ins(ctlr, WTyp_HasCrypt) == 0) PRINTSTR("WEP: not supported\n"); else { if(ltv_ins(ctlr, WTyp_Crypt) == 0) PRINTSTR("WEP: disabled\n"); else{ PRINTSTR("WEP: enabled\n"); k = ((ctlr->xclear)? "excluded": "included"); PRINTSTAT("Clear packets: %s\n", k); txid = ltv_ins(ctlr, WTyp_TxKey); PRINTSTAT("Transmit key id: %d\n", txid); } } iunlock(ctlr); PRINTSTAT("ntxuframes: %lud\n", ctlr->ntxuframes); PRINTSTAT("ntxmframes: %lud\n", ctlr->ntxmframes); PRINTSTAT("ntxfrags: %lud\n", ctlr->ntxfrags); PRINTSTAT("ntxubytes: %lud\n", ctlr->ntxubytes); PRINTSTAT("ntxmbytes: %lud\n", ctlr->ntxmbytes); PRINTSTAT("ntxdeferred: %lud\n", ctlr->ntxdeferred); PRINTSTAT("ntxsretries: %lud\n", ctlr->ntxsretries); PRINTSTAT("ntxmultiretries: %lud\n", ctlr->ntxmultiretries); PRINTSTAT("ntxretrylimit: %lud\n", ctlr->ntxretrylimit); PRINTSTAT("ntxdiscards: %lud\n", ctlr->ntxdiscards); PRINTSTAT("nrxuframes: %lud\n", ctlr->nrxuframes); PRINTSTAT("nrxmframes: %lud\n", ctlr->nrxmframes); PRINTSTAT("nrxfrags: %lud\n", ctlr->nrxfrags); PRINTSTAT("nrxubytes: %lud\n", ctlr->nrxubytes); PRINTSTAT("nrxmbytes: %lud\n", ctlr->nrxmbytes); PRINTSTAT("nrxfcserr: %lud\n", ctlr->nrxfcserr); PRINTSTAT("nrxdropnobuf: %lud\n", ctlr->nrxdropnobuf); PRINTSTAT("nrxdropnosa: %lud\n", ctlr->nrxdropnosa); PRINTSTAT("nrxcantdecrypt: %lud\n", ctlr->nrxcantdecrypt); PRINTSTAT("nrxmsgfrag: %lud\n", ctlr->nrxmsgfrag); PRINTSTAT("nrxmsgbadfrag: %lud\n", ctlr->nrxmsgbadfrag); USED(l); n = readstr(offset, a, n, p); free(p); return n; }