=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/vmstat/vmstat.c,v retrieving revision 1.89 retrieving revision 1.90 diff -c -r1.89 -r1.90 *** src/usr.bin/vmstat/vmstat.c 2004/07/02 09:12:37 1.89 --- src/usr.bin/vmstat/vmstat.c 2004/09/23 21:09:39 1.90 *************** *** 1,5 **** /* $NetBSD: vmstat.c,v 1.29.4.1 1996/06/05 00:21:05 cgd Exp $ */ ! /* $OpenBSD: vmstat.c,v 1.89 2004/07/02 09:12:37 miod Exp $ */ /* * Copyright (c) 1980, 1986, 1991, 1993 --- 1,5 ---- /* $NetBSD: vmstat.c,v 1.29.4.1 1996/06/05 00:21:05 cgd Exp $ */ ! /* $OpenBSD: vmstat.c,v 1.90 2004/09/23 21:09:39 deraadt Exp $ */ /* * Copyright (c) 1980, 1986, 1991, 1993 *************** *** 40,46 **** #if 0 static char sccsid[] = "@(#)vmstat.c 8.1 (Berkeley) 6/6/93"; #else ! static const char rcsid[] = "$OpenBSD: vmstat.c,v 1.89 2004/07/02 09:12:37 miod Exp $"; #endif #endif /* not lint */ --- 40,46 ---- #if 0 static char sccsid[] = "@(#)vmstat.c 8.1 (Berkeley) 6/6/93"; #else ! static const char rcsid[] = "$OpenBSD: vmstat.c,v 1.90 2004/09/23 21:09:39 deraadt Exp $"; #endif #endif /* not lint */ *************** *** 471,476 **** --- 471,477 ---- /* * Force a header to be prepended to the next output. */ + /* ARGSUSED */ void needhdr(int signo) { *************** *** 726,732 **** struct device dev; time_t uptime; ! long inttotal; int nintr; char intrname[128]; int mib[4]; --- 727,733 ---- struct device dev; time_t uptime; ! u_int64_t inttotal; int nintr; char intrname[128]; int mib[4]; *************** *** 744,755 **** return; } ! (void)printf("interrupt total rate\n"); inttotal = 0; for (i = 0; i < nintr; i++) { char name[128]; ! int cnt; int vector; mib[0] = CTL_KERN; --- 745,756 ---- return; } ! (void)printf("%-12s %20s %8s\n", "interrupt", "total", "rate"); inttotal = 0; for (i = 0; i < nintr; i++) { char name[128]; ! u_quad_t cnt; int vector; mib[0] = CTL_KERN; *************** *** 781,791 **** siz = sizeof(cnt); if (sysctl(mib, 4, &cnt, &siz, NULL, 0) < 0) { warnx("could not read kern.intrcnt.cnt.%d", i); ! return ; } if (cnt || zflag) ! (void)printf("%-16.16s %12d %8ld\n", intrname, ! cnt, (long)cnt / uptime); inttotal += cnt; } --- 782,793 ---- siz = sizeof(cnt); if (sysctl(mib, 4, &cnt, &siz, NULL, 0) < 0) { warnx("could not read kern.intrcnt.cnt.%d", i); ! return; } + if (cnt || zflag) ! (void)printf("%-12.12s %20llu %8llu\n", intrname, ! cnt, cnt / uptime); inttotal += cnt; } *************** *** 800,818 **** sizeof dev) != sizeof dev) errx(1, "event chain trashed: %s", kvm_geterr(kd)); if (evcnt.ev_count) ! (void)printf("%-14s %12d %8ld\n", dev.dv_xname, ! evcnt.ev_count, (long)(evcnt.ev_count / uptime)); ! inttotal += evcnt.ev_count++; } evptr = evcnt.ev_list.tqe_next; } ! (void)printf("Total %12ld %8ld\n", inttotal, inttotal / uptime); } static void dointr_kvm(void) { ! long *intrcnt, inttotal; time_t uptime; int nintr, inamlen; char *intrname; --- 802,823 ---- sizeof dev) != sizeof dev) errx(1, "event chain trashed: %s", kvm_geterr(kd)); if (evcnt.ev_count) ! (void)printf("%-12.12s %20llu %8llu\n", ! dev.dv_xname, ! evcnt.ev_count, evcnt.ev_count / uptime); ! inttotal += evcnt.ev_count; } evptr = evcnt.ev_list.tqe_next; } ! (void)printf("%-12s %20llu %8llu\n", "Total", inttotal, ! inttotal / uptime); } static void dointr_kvm(void) { ! long *intrcnt; ! u_int64_t inttotal; time_t uptime; int nintr, inamlen; char *intrname; *************** *** 830,841 **** err(1, "malloc"); kread(X_INTRCNT, intrcnt, (size_t)nintr); kread(X_INTRNAMES, intrname, (size_t)inamlen); ! (void)printf("interrupt total rate\n"); inttotal = 0; nintr /= sizeof(long); while (--nintr >= 0) { if (*intrcnt) ! (void)printf("%-14s %12ld %8ld\n", intrname, *intrcnt, *intrcnt / uptime); intrname += strlen(intrname) + 1; inttotal += *intrcnt++; --- 835,846 ---- err(1, "malloc"); kread(X_INTRCNT, intrcnt, (size_t)nintr); kread(X_INTRNAMES, intrname, (size_t)inamlen); ! (void)printf("%-12s %20s %8s\n", "interrupt", "total", "rate"); inttotal = 0; nintr /= sizeof(long); while (--nintr >= 0) { if (*intrcnt) ! (void)printf("%-12.12s %20lu %8lu\n", intrname, *intrcnt, *intrcnt / uptime); intrname += strlen(intrname) + 1; inttotal += *intrcnt++; *************** *** 851,863 **** sizeof dev) != sizeof dev) errx(1, "event chain trashed: %s", kvm_geterr(kd)); if (evcnt.ev_count) ! (void)printf("%-14s %12d %8ld\n", dev.dv_xname, ! evcnt.ev_count, (long)(evcnt.ev_count / uptime)); ! inttotal += evcnt.ev_count++; } evptr = evcnt.ev_list.tqe_next; } ! (void)printf("Total %12ld %8ld\n", inttotal, inttotal / uptime); } /* --- 856,869 ---- sizeof dev) != sizeof dev) errx(1, "event chain trashed: %s", kvm_geterr(kd)); if (evcnt.ev_count) ! (void)printf("%-12.12s %20lu %8lu\n", dev.dv_xname, ! evcnt.ev_count, evcnt.ev_count / uptime); ! inttotal += evcnt.ev_count; } evptr = evcnt.ev_list.tqe_next; } ! (void)printf("%-12s %20llu %8llu\n", "Total", inttotal, ! inttotal / uptime); } /*