diff options
Diffstat (limited to 'usr.bin/systat')
-rw-r--r-- | usr.bin/systat/cmds.c | 15 | ||||
-rw-r--r-- | usr.bin/systat/disks.c | 11 | ||||
-rw-r--r-- | usr.bin/systat/fetch.c | 8 | ||||
-rw-r--r-- | usr.bin/systat/iostat.c | 39 | ||||
-rw-r--r-- | usr.bin/systat/keyboard.c | 6 | ||||
-rw-r--r-- | usr.bin/systat/mbufs.c | 17 | ||||
-rw-r--r-- | usr.bin/systat/netcmds.c | 38 | ||||
-rw-r--r-- | usr.bin/systat/netstat.c | 45 | ||||
-rw-r--r-- | usr.bin/systat/pigs.c | 24 | ||||
-rw-r--r-- | usr.bin/systat/swap.c | 18 | ||||
-rw-r--r-- | usr.bin/systat/vmstat.c | 67 |
11 files changed, 115 insertions, 173 deletions
diff --git a/usr.bin/systat/cmds.c b/usr.bin/systat/cmds.c index dd79bd471c8..9f3934b0215 100644 --- a/usr.bin/systat/cmds.c +++ b/usr.bin/systat/cmds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmds.c,v 1.10 2001/12/07 09:18:08 deraadt Exp $ */ +/* $OpenBSD: cmds.c,v 1.11 2002/06/18 00:46:47 deraadt Exp $ */ /* $NetBSD: cmds.c,v 1.4 1996/05/10 23:16:32 thorpej Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)cmds.c 8.2 (Berkeley) 4/29/95"; #endif -static char rcsid[] = "$OpenBSD: cmds.c,v 1.10 2001/12/07 09:18:08 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: cmds.c,v 1.11 2002/06/18 00:46:47 deraadt Exp $"; #endif /* not lint */ #include <stdlib.h> @@ -50,8 +50,7 @@ static char rcsid[] = "$OpenBSD: cmds.c,v 1.10 2001/12/07 09:18:08 deraadt Exp $ #include "extern.h" void -command(cmd) - char *cmd; +command(char *cmd) { struct cmdtab *p; char *cp; @@ -151,8 +150,7 @@ done: } struct cmdtab * -lookup(name) - char *name; +lookup(char *name) { char *p, *q; struct cmdtab *c, *found; @@ -180,7 +178,7 @@ lookup(name) } void -status() +status(void) { error("Showing %s, refresh every %d seconds.", @@ -188,8 +186,7 @@ status() } int -prefix(s1, s2) - char *s1, *s2; +prefix(char *s1, char *s2) { while (*s1 == *s2) { diff --git a/usr.bin/systat/disks.c b/usr.bin/systat/disks.c index 8c8fa8a8d5e..b1ed2a65ee8 100644 --- a/usr.bin/systat/disks.c +++ b/usr.bin/systat/disks.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disks.c,v 1.12 2001/12/07 09:18:08 deraadt Exp $ */ +/* $OpenBSD: disks.c,v 1.13 2002/06/18 00:46:47 deraadt Exp $ */ /* $NetBSD: disks.c,v 1.4 1996/05/10 23:16:33 thorpej Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)disks.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: disks.c,v 1.12 2001/12/07 09:18:08 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: disks.c,v 1.13 2002/06/18 00:46:47 deraadt Exp $"; #endif /* not lint */ #include <string.h> @@ -50,8 +50,7 @@ static void dkselect(char *args, int truefalse, int selections[]); int -dkcmd(cmd, args) - char *cmd, *args; +dkcmd(char *cmd, char *args) { if (prefix(cmd, "display") || prefix(cmd, "add")) { dkselect(args, 1, dk_select); @@ -73,9 +72,7 @@ dkcmd(cmd, args) } static void -dkselect(args, truefalse, selections) - char *args; - int truefalse, selections[]; +dkselect(char *args, int truefalse, int selections[]) { char *cp; int i; diff --git a/usr.bin/systat/fetch.c b/usr.bin/systat/fetch.c index 5999d07a363..da202eb19b8 100644 --- a/usr.bin/systat/fetch.c +++ b/usr.bin/systat/fetch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fetch.c,v 1.5 2001/12/07 09:18:08 deraadt Exp $ */ +/* $OpenBSD: fetch.c,v 1.6 2002/06/18 00:46:47 deraadt Exp $ */ /* $NetBSD: fetch.c,v 1.2 1995/01/20 08:51:56 jtc Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)fetch.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: fetch.c,v 1.5 2001/12/07 09:18:08 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: fetch.c,v 1.6 2002/06/18 00:46:47 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -47,9 +47,7 @@ static char rcsid[] = "$OpenBSD: fetch.c,v 1.5 2001/12/07 09:18:08 deraadt Exp $ #include "extern.h" int -kvm_ckread(a, b, l) - void *a, *b; - int l; +kvm_ckread(void *a, void *b, int l) { if (kvm_read(kd, (u_long)a, b, l) != l) { if (verbose) diff --git a/usr.bin/systat/iostat.c b/usr.bin/systat/iostat.c index eab413a7db9..1723e54edba 100644 --- a/usr.bin/systat/iostat.c +++ b/usr.bin/systat/iostat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iostat.c,v 1.17 2002/02/16 21:27:54 millert Exp $ */ +/* $OpenBSD: iostat.c,v 1.18 2002/06/18 00:46:47 deraadt Exp $ */ /* $NetBSD: iostat.c,v 1.5 1996/05/10 23:16:35 thorpej Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)iostat.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: iostat.c,v 1.17 2002/02/16 21:27:54 millert Exp $"; +static char rcsid[] = "$OpenBSD: iostat.c,v 1.18 2002/06/18 00:46:47 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -68,14 +68,13 @@ static void stat1(int, int); WINDOW * -openiostat() +openiostat(void) { return (subwin(stdscr, LINES-1-5, 0, 5, 0)); } void -closeiostat(w) - WINDOW *w; +closeiostat(WINDOW *w) { if (w == NULL) return; @@ -85,7 +84,7 @@ closeiostat(w) } int -initiostat() +initiostat(void) { dkinit(1); dkreadstats(); @@ -93,7 +92,7 @@ initiostat() } void -fetchiostat() +fetchiostat(void) { if (dk_ndrive == 0) return; @@ -103,7 +102,7 @@ fetchiostat() #define INSET 10 void -labeliostat() +labeliostat(void) { int row; @@ -123,8 +122,7 @@ labeliostat() } static int -numlabels(row) - int row; +numlabels(int row) { int i, col, regions, ndrives; @@ -166,8 +164,7 @@ numlabels(row) } static int -barlabels(row) - int row; +barlabels(int row) { int i; @@ -192,14 +189,14 @@ barlabels(row) void -showiostat() +showiostat(void) { int i, row, col; dkswap(); etime = 0; - for(i = 0; i < CPUSTATES; i++) { + for (i = 0; i < CPUSTATES; i++) { etime += cur.cp_time[i]; } if (etime == 0.0) @@ -248,8 +245,7 @@ showiostat() } static int -stats(row, col, dn) - int row, col, dn; +stats(int row, int col, int dn) { double atime, words; @@ -276,8 +272,7 @@ stats(row, col, dn) } static void -stat1(row, o) - int row, o; +stat1(int row, int o) { int i; double time; @@ -293,10 +288,7 @@ stat1(row, o) } static void -histogram(val, colwidth, scale) - double val; - int colwidth; - double scale; +histogram(double val, int colwidth, double scale) { char buf[10]; int k; @@ -318,8 +310,7 @@ histogram(val, colwidth, scale) } int -cmdiostat(cmd, args) - char *cmd, *args; +cmdiostat(char *cmd, char *args) { if (prefix(cmd, "secs")) diff --git a/usr.bin/systat/keyboard.c b/usr.bin/systat/keyboard.c index 984eb7894e4..fbddd3f3bcd 100644 --- a/usr.bin/systat/keyboard.c +++ b/usr.bin/systat/keyboard.c @@ -1,4 +1,4 @@ -/* $OpenBSD: keyboard.c,v 1.11 2002/02/18 23:34:46 deraadt Exp $ */ +/* $OpenBSD: keyboard.c,v 1.12 2002/06/18 00:46:47 deraadt Exp $ */ /* $NetBSD: keyboard.c,v 1.2 1995/01/20 08:51:59 jtc Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)keyboard.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: keyboard.c,v 1.11 2002/02/18 23:34:46 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: keyboard.c,v 1.12 2002/06/18 00:46:47 deraadt Exp $"; #endif /* not lint */ #include <ctype.h> @@ -50,7 +50,7 @@ static char rcsid[] = "$OpenBSD: keyboard.c,v 1.11 2002/02/18 23:34:46 deraadt E #include "extern.h" void -keyboard() +keyboard(void) { char line[80]; sigset_t mask, omask; diff --git a/usr.bin/systat/mbufs.c b/usr.bin/systat/mbufs.c index 2f17811b3fc..08a62120035 100644 --- a/usr.bin/systat/mbufs.c +++ b/usr.bin/systat/mbufs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mbufs.c,v 1.10 2002/06/09 05:16:20 angelos Exp $ */ +/* $OpenBSD: mbufs.c,v 1.11 2002/06/18 00:46:47 deraadt Exp $ */ /* $NetBSD: mbufs.c,v 1.2 1995/01/20 08:52:02 jtc Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)mbufs.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: mbufs.c,v 1.10 2002/06/09 05:16:20 angelos Exp $"; +static char rcsid[] = "$OpenBSD: mbufs.c,v 1.11 2002/06/18 00:46:47 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -76,14 +76,13 @@ char *mtnames[] = { #define NNAMES (sizeof (mtnames) / sizeof (mtnames[0])) WINDOW * -openmbufs() +openmbufs(void) { return (subwin(stdscr, LINES-5-1, 0, 5, 0)); } void -closembufs(w) - WINDOW *w; +closembufs(WINDOW *w) { if (w == NULL) return; @@ -93,7 +92,7 @@ closembufs(w) } void -labelmbufs() +labelmbufs(void) { wmove(wnd, 0, 0); wclrtoeol(wnd); mvwaddstr(wnd, 0, 10, @@ -101,7 +100,7 @@ labelmbufs() } void -showmbufs() +showmbufs(void) { int i, j, max, index; char buf[13]; @@ -145,7 +144,7 @@ static struct nlist namelist[] = { }; int -initmbufs() +initmbufs(void) { int ret; @@ -167,7 +166,7 @@ initmbufs() } void -fetchmbufs() +fetchmbufs(void) { int mib[2]; size_t size = sizeof (*mb); diff --git a/usr.bin/systat/netcmds.c b/usr.bin/systat/netcmds.c index 08a08790ac1..83034efffea 100644 --- a/usr.bin/systat/netcmds.c +++ b/usr.bin/systat/netcmds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netcmds.c,v 1.10 2002/02/16 21:27:54 millert Exp $ */ +/* $OpenBSD: netcmds.c,v 1.11 2002/06/18 00:46:47 deraadt Exp $ */ /* $NetBSD: netcmds.c,v 1.4 1995/05/21 17:14:38 mycroft Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)netcmds.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: netcmds.c,v 1.10 2002/02/16 21:27:54 millert Exp $"; +static char rcsid[] = "$OpenBSD: netcmds.c,v 1.11 2002/06/18 00:46:47 deraadt Exp $"; #endif /* not lint */ /* @@ -84,8 +84,7 @@ static int selecthost(struct sockaddr *, int); static void showhosts(void); int -netcmd(cmd, args) - char *cmd, *args; +netcmd(char *cmd, char *args) { if (prefix(cmd, "tcp") || prefix(cmd, "udp")) { @@ -125,9 +124,7 @@ netcmd(cmd, args) static void -changeitems(args, onoff) - char *args; - int onoff; +changeitems(char *args, int onoff) { char *cp; struct servent *sp; @@ -167,8 +164,7 @@ changeitems(args, onoff) } static int -selectproto(proto) - char *proto; +selectproto(char *proto) { int new = protos; @@ -182,7 +178,7 @@ selectproto(proto) } static void -showprotos() +showprotos(void) { if ((protos&TCP) == 0) @@ -199,9 +195,7 @@ static struct pitem { } *ports; static int -selectport(port, onoff) - long port; - int onoff; +selectport(long port, int onoff) { struct pitem *p; @@ -228,8 +222,7 @@ selectport(port, onoff) } int -checkport(inp) - struct inpcb *inp; +checkport(struct inpcb *inp) { struct pitem *p; @@ -241,7 +234,7 @@ checkport(inp) } static void -showports() +showports(void) { struct pitem *p; struct servent *sp; @@ -259,9 +252,7 @@ showports() } static int -addrcmp(sa1, sa2) - struct sockaddr *sa1; - struct sockaddr *sa2; +addrcmp(struct sockaddr *sa1, struct sockaddr *sa2) { if (sa1->sa_family != sa2->sa_family) return 0; @@ -289,9 +280,7 @@ addrcmp(sa1, sa2) } static int -selecthost(sa, onoff) - struct sockaddr *sa; - int onoff; +selecthost(struct sockaddr *sa, int onoff) { struct hitem *p; @@ -320,8 +309,7 @@ selecthost(sa, onoff) } int -checkhost(inp) - struct inpcb *inp; +checkhost(struct inpcb *inp) { struct hitem *p; @@ -350,7 +338,7 @@ checkhost(inp) } static void -showhosts() +showhosts(void) { struct hitem *p; char hbuf[NI_MAXHOST]; diff --git a/usr.bin/systat/netstat.c b/usr.bin/systat/netstat.c index 952e28ecf38..27fdb109d58 100644 --- a/usr.bin/systat/netstat.c +++ b/usr.bin/systat/netstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netstat.c,v 1.21 2002/02/16 21:27:54 millert Exp $ */ +/* $OpenBSD: netstat.c,v 1.22 2002/06/18 00:46:47 deraadt Exp $ */ /* $NetBSD: netstat.c,v 1.3 1995/06/18 23:53:07 cgd Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)netstat.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: netstat.c,v 1.21 2002/02/16 21:27:54 millert Exp $"; +static char rcsid[] = "$OpenBSD: netstat.c,v 1.22 2002/06/18 00:46:47 deraadt Exp $"; #endif /* not lint */ /* @@ -91,7 +91,7 @@ static void inet6print(struct in6_addr *, int, char *); #define YMAX(w) ((w)->_maxy-1) WINDOW * -opennetstat() +opennetstat(void) { sethostent(1); setnetent(1); @@ -131,8 +131,7 @@ static int nflag = 0; static int lastrow = 1; void -closenetstat(w) - WINDOW *w; +closenetstat(WINDOW *w) { struct netinfo *p; @@ -161,7 +160,7 @@ static struct nlist namelist[] = { }; int -initnetstat() +initnetstat(void) { int ret; @@ -179,7 +178,7 @@ initnetstat() } void -fetchnetstat() +fetchnetstat(void) { struct inpcbtable pcbtable; struct inpcb *head, *prev, *next; @@ -211,7 +210,8 @@ again: while (next != head) { KREAD(next, &inpcb, sizeof (inpcb)); if (inpcb.inp_queue.cqe_prev != prev) { -printf("prev = %p, head = %p, next = %p, inpcb...prev = %p\n", prev, head, next, inpcb.inp_queue.cqe_prev); + printf("prev = %p, head = %p, next = %p, inpcb...prev = %p\n", + prev, head, next, inpcb.inp_queue.cqe_prev); p = netcb.nif_forw; for (; p != (struct netinfo *)&netcb; p = p->nif_forw) p->nif_seen = 1; @@ -255,11 +255,7 @@ printf("prev = %p, head = %p, next = %p, inpcb...prev = %p\n", prev, head, next, } static void -enter(inp, so, state, proto) - struct inpcb *inp; - struct socket *so; - int state; - char *proto; +enter(struct inpcb *inp, struct socket *so, int state, char *proto) { struct netinfo *p; @@ -344,7 +340,7 @@ enter(inp, so, state, proto) void -labelnetstat() +labelnetstat(void) { if (namelist[X_TCBTABLE].n_type == 0) return; @@ -358,7 +354,7 @@ labelnetstat() } void -shownetstat() +shownetstat(void) { struct netinfo *p, *q; @@ -461,10 +457,7 @@ shownetstat() * If the nflag was specified, use numbers instead of names. */ static void -inetprint(in, port, proto) - struct in_addr *in; - int port; - char *proto; +inetprint(struct in_addr *in, int port, char *proto) { struct servent *sp = 0; char line[80], *cp; @@ -489,10 +482,7 @@ inetprint(in, port, proto) #ifdef INET6 static void -inet6print(in6, port, proto) - struct in6_addr *in6; - int port; - char *proto; +inet6print(struct in6_addr *in6, int port, char *proto) { struct servent *sp = 0; char line[80], *cp; @@ -522,8 +512,7 @@ inet6print(in6, port, proto) * numeric value, otherwise try for symbolic name. */ static const char * -inetname(in) - struct in_addr in; +inetname(struct in_addr in) { char *cp = 0; static char line[50]; @@ -560,8 +549,7 @@ inetname(in) #ifdef INET6 static const char * -inet6name(in6) - struct in6_addr *in6; +inet6name(struct in6_addr *in6) { static char line[NI_MAXHOST]; struct sockaddr_in6 sin6; @@ -585,8 +573,7 @@ inet6name(in6) #endif int -cmdnetstat(cmd, args) - char *cmd, *args; +cmdnetstat(char *cmd, char *args) { struct netinfo *p; diff --git a/usr.bin/systat/pigs.c b/usr.bin/systat/pigs.c index 822648d3b80..7550f680be6 100644 --- a/usr.bin/systat/pigs.c +++ b/usr.bin/systat/pigs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pigs.c,v 1.13 2002/02/16 21:27:54 millert Exp $ */ +/* $OpenBSD: pigs.c,v 1.14 2002/06/18 00:46:48 deraadt Exp $ */ /* $NetBSD: pigs.c,v 1.3 1995/04/29 05:54:50 cgd Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)pigs.c 8.2 (Berkeley) 9/23/93"; #endif -static char rcsid[] = "$OpenBSD: pigs.c,v 1.13 2002/02/16 21:27:54 millert Exp $"; +static char rcsid[] = "$OpenBSD: pigs.c,v 1.14 2002/06/18 00:46:48 deraadt Exp $"; #endif /* not lint */ /* @@ -75,14 +75,13 @@ static long stime[CPUSTATES]; static double lccpu; WINDOW * -openpigs() +openpigs(void) { return (subwin(stdscr, LINES-5-1, 0, 5, 0)); } void -closepigs(w) - WINDOW *w; +closepigs(WINDOW *w) { if (w == NULL) return; @@ -93,7 +92,7 @@ closepigs(w) void -showpigs() +showpigs(void) { int i, j, y, k; struct eproc *ep; @@ -111,7 +110,7 @@ showpigs() } if (total < 1.0) - total = 1.0; + total = 1.0; factor = 50.0/total; qsort(pt, nproc + 1, sizeof (struct p_times), compar); @@ -143,7 +142,7 @@ showpigs() struct loadavg sysload; int -initpigs() +initpigs(void) { static int sysload_mib[] = {CTL_VM, VM_LOADAVG}; static int cp_time_mib[] = { CTL_KERN, KERN_CPTIME }; @@ -166,7 +165,7 @@ initpigs() } void -fetchpigs() +fetchpigs(void) { static int cp_time_mib[] = { CTL_KERN, KERN_CPTIME }; static int lastnproc = 0; @@ -226,7 +225,7 @@ fetchpigs() } void -labelpigs() +labelpigs(void) { wmove(wnd, 0, 0); wclrtoeol(wnd); @@ -235,9 +234,8 @@ labelpigs() } int -compar(a, b) - const void *a, *b; +compar(const void *a, const void *b) { return (((struct p_times *) a)->pt_pctcpu > - ((struct p_times *) b)->pt_pctcpu)? -1: 1; + ((struct p_times *) b)->pt_pctcpu)? -1: 1; } diff --git a/usr.bin/systat/swap.c b/usr.bin/systat/swap.c index 30d0e007514..a6bab38952f 100644 --- a/usr.bin/systat/swap.c +++ b/usr.bin/systat/swap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: swap.c,v 1.15 2002/02/16 21:27:54 millert Exp $ */ +/* $OpenBSD: swap.c,v 1.16 2002/06/18 00:46:48 deraadt Exp $ */ /* $NetBSD: swap.c,v 1.9 1998/12/26 07:05:08 marc Exp $ */ /*- @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)swap.c 8.3 (Berkeley) 4/29/95"; #endif -static char rcsid[] = "$OpenBSD: swap.c,v 1.15 2002/02/16 21:27:54 millert Exp $"; +static char rcsid[] = "$OpenBSD: swap.c,v 1.16 2002/06/18 00:46:48 deraadt Exp $"; #endif /* not lint */ #include <sys/cdefs.h> @@ -67,14 +67,13 @@ static int first = 1; static struct swapent *swap_devices; WINDOW * -openswap() +openswap(void) { return (subwin(stdscr, LINES-5-1, 0, 5, 0)); } void -closeswap(w) - WINDOW *w; +closeswap(WINDOW *w) { if (w == NULL) return; @@ -85,13 +84,13 @@ closeswap(w) /* do nothing */ int -initswap() +initswap(void) { return (1); } void -fetchswap() +fetchswap(void) { int update_label = 0; @@ -119,7 +118,7 @@ fetchswap() } void -labelswap() +labelswap(void) { char *header; int row; @@ -140,7 +139,8 @@ labelswap() } void -showswap() { +showswap(void) +{ int col, div, i, j, avail, used, xsize, free; struct swapent *sep; char *p; diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c index 320a1439af4..d2fbeae3b9f 100644 --- a/usr.bin/systat/vmstat.c +++ b/usr.bin/systat/vmstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmstat.c,v 1.34 2002/04/29 17:28:12 millert Exp $ */ +/* $OpenBSD: vmstat.c,v 1.35 2002/06/18 00:46:48 deraadt Exp $ */ /* $NetBSD: vmstat.c,v 1.5 1996/05/10 23:16:40 thorpej Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94"; #endif -static char rcsid[] = "$OpenBSD: vmstat.c,v 1.34 2002/04/29 17:28:12 millert Exp $"; +static char rcsid[] = "$OpenBSD: vmstat.c,v 1.35 2002/06/18 00:46:48 deraadt Exp $"; #endif /* not lint */ /* @@ -118,7 +118,7 @@ static int nextintsrow; struct utmp utmp; WINDOW * -openkre() +openkre(void) { ut = open(_PATH_UTMP, O_RDONLY); @@ -128,8 +128,7 @@ openkre() } void -closekre(w) - WINDOW *w; +closekre(WINDOW *w) { (void) close(ut); @@ -141,18 +140,16 @@ closekre(w) static struct nlist namelist[] = { -#define X_HZ 0 - { "_hz" }, -#define X_INTRNAMES 1 +#define X_INTRNAMES 0 { "_intrnames" }, -#define X_EINTRNAMES 2 +#define X_EINTRNAMES 1 { "_eintrnames" }, -#define X_INTRCNT 3 +#define X_INTRCNT 2 { "_intrcnt" }, -#define X_EINTRCNT 4 +#define X_EINTRCNT 3 { "_eintrcnt" }, #if defined(__i386__) -#define X_INTRHAND 5 +#define X_INTRHAND 4 { "_intrhand" }, #endif { "" }, @@ -185,7 +182,7 @@ static struct nlist namelist[] = { #define DRIVESPACE 45 /* max space for drives */ int -initkre() +initkre(void) { char *intrnamebuf, *cp; int i, ret; @@ -271,7 +268,7 @@ initkre() } void -fetchkre() +fetchkre(void) { time_t now; @@ -281,7 +278,7 @@ fetchkre() } void -labelkre() +labelkre(void) { int i, j, l; @@ -350,10 +347,10 @@ labelkre() } } -#define X(fld) {t=s.fld[i]; s.fld[i]-=s1.fld[i]; if(state==TIME) s1.fld[i]=t;} -#define Y(fld) {t = s.fld; s.fld -= s1.fld; if(state == TIME) s1.fld = t;} +#define X(fld) {t=s.fld[i]; s.fld[i]-=s1.fld[i]; if (state==TIME) s1.fld[i]=t;} +#define Y(fld) {t = s.fld; s.fld -= s1.fld; if (state == TIME) s1.fld = t;} #define Z(fld) {t = s.nchstats.fld; s.nchstats.fld -= s1.nchstats.fld; \ - if(state == TIME) s1.nchstats.fld = t;} + if (state == TIME) s1.nchstats.fld = t;} #define PUTRATE(fld, l, c, w) \ Y(fld); \ putint((int)((float)s.fld/etime + 0.5), l, c, w) @@ -363,7 +360,7 @@ static char cpuchar[CPUSTATES] = { '=' , '>', '-', ' ' }; static char cpuorder[CPUSTATES] = { CP_SYS, CP_USER, CP_NICE, CP_IDLE }; void -showkre() +showkre(void) { float f1, f2; int psiz, inttotal; @@ -373,7 +370,7 @@ showkre() if (state == TIME) dkswap(); etime = 0; - for(i = 0; i < CPUSTATES; i++) { + for (i = 0; i < CPUSTATES; i++) { X(time); etime += s.time[i]; } @@ -510,7 +507,7 @@ showkre() c += 1 + l; dinfo(i, c); } - /* and pad the DRIVESPACE */ + /* and pad the DRIVESPACE */ l = DRIVESPACE - c; for (i = 0; i < 5; i++) mvprintw(DISKROW + i, DISKCOL + 5 + c, "%*s", l, ""); @@ -531,8 +528,7 @@ showkre() } int -cmdkre(cmd, args) - char *cmd, *args; +cmdkre(char *cmd, char *args) { if (prefix(cmd, "run")) { @@ -559,7 +555,7 @@ cmdkre(cmd, args) /* calculate number of users on the system */ static int -ucount() +ucount(void) { int nusers = 0; @@ -574,8 +570,7 @@ ucount() } static float -cputime(indx) - int indx; +cputime(int indx) { double t; int i; @@ -589,8 +584,7 @@ cputime(indx) } static void -putint(n, l, c, w) - int n, l, c, w; +putint(int n, int l, int c, int w) { char b[128]; @@ -610,9 +604,7 @@ putint(n, l, c, w) } static void -putfloat(f, l, c, w, d, nz) - double f; - int l, c, w, d, nz; +putfloat(double f, int l, int c, int w, int d, int nz) { char b[128]; @@ -632,9 +624,7 @@ putfloat(f, l, c, w, d, nz) } static void -getinfo(s, st) - struct Info *s; - enum state st; +getinfo(struct Info *s, enum state st) { static int cp_time_mib[] = { CTL_KERN, KERN_CPTIME }; static int nchstats_mib[2] = { CTL_KERN, KERN_NCHSTATS }; @@ -686,8 +676,7 @@ getinfo(s, st) } static void -allocinfo(s) - struct Info *s; +allocinfo(struct Info *s) { s->intrcnt = (long *) malloc(nintr * sizeof(long)); @@ -696,8 +685,7 @@ allocinfo(s) } static void -copyinfo(from, to) - struct Info *from, *to; +copyinfo(struct Info *from, struct Info *to) { long *intrcnt; @@ -707,8 +695,7 @@ copyinfo(from, to) } static void -dinfo(dn, c) - int dn, c; +dinfo(int dn, int c) { double words, atime; |