=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/systat/vmstat.c,v retrieving revision 1.47 retrieving revision 1.48 diff -c -r1.47 -r1.48 *** src/usr.bin/systat/vmstat.c 2004/05/22 18:06:12 1.47 --- src/usr.bin/systat/vmstat.c 2004/06/11 05:55:43 1.48 *************** *** 1,4 **** ! /* $OpenBSD: vmstat.c,v 1.47 2004/05/22 18:06:12 henning Exp $ */ /* $NetBSD: vmstat.c,v 1.5 1996/05/10 23:16:40 thorpej Exp $ */ /*- --- 1,4 ---- ! /* $OpenBSD: vmstat.c,v 1.48 2004/06/11 05:55:43 deraadt Exp $ */ /* $NetBSD: vmstat.c,v 1.5 1996/05/10 23:16:40 thorpej Exp $ */ /*- *************** *** 34,40 **** #if 0 static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94"; #endif ! static char rcsid[] = "$OpenBSD: vmstat.c,v 1.47 2004/05/22 18:06:12 henning Exp $"; #endif /* not lint */ /* --- 34,40 ---- #if 0 static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94"; #endif ! static char rcsid[] = "$OpenBSD: vmstat.c,v 1.48 2004/06/11 05:55:43 deraadt Exp $"; #endif /* not lint */ /* *************** *** 147,152 **** --- 147,154 ---- #if defined(__i386__) #define X_INTRHAND 4 /* no sysctl */ { "_intrhand" }, + #define X_APICINTRHAND 5 /* no sysctl */ + { "_apic_intrhand" }, #endif { "" }, }; *************** *** 186,191 **** --- 188,197 ---- if (namelist[0].n_type == 0) { if ((ret = kvm_nlist(kd, namelist)) == -1) errx(1, "%s", kvm_geterr(kd)); + #if defined(__i386__) + else if (ret > 1 && namelist[X_APICINTRHAND].n_value == 0) + nlisterr(namelist); + #endif else if (ret) nlisterr(namelist); if (namelist[0].n_type == 0) { *************** *** 199,204 **** --- 205,211 ---- if (nintr == 0) { #if defined(__i386__) struct intrhand *intrhand[16], *ihp, ih; + struct intrhand *apicintrhand[256]; char iname[16]; int namelen, n; *************** *** 213,218 **** --- 220,239 ---- ihp = ih.ih_next; } } + if (namelist[X_APICINTRHAND].n_value) { + NREAD(X_APICINTRHAND, apicintrhand, sizeof(apicintrhand)); + for (namelen = 0, i = 0; i < 256; i++) { + ihp = apicintrhand[i]; + while (ihp) { + nintr++; + KREAD(ihp, &ih, sizeof(ih)); + KREAD(ih.ih_what, iname, 16); + namelen += strlen(iname) + 1; + printf("apic handler %x %s\n", i, iname); + ihp = ih.ih_next; + } + } + } intrloc = calloc(nintr, sizeof (long)); intrname = calloc(nintr, sizeof (char *)); cp = intrnamebuf = malloc(namelen); *************** *** 227,232 **** --- 248,266 ---- ihp = ih.ih_next; } } + if (namelist[X_APICINTRHAND].n_value) { + for (i = 0, n = 0; i < 256; i++) { + ihp = apicintrhand[i]; + while (ihp) { + KREAD(ihp, &ih, sizeof(ih)); + KREAD(ih.ih_what, iname, 16); + intrname[n++] = cp; + strlcpy(cp, iname, intrnamebuf + namelen - cp); + cp += strlen(iname) + 1; + ihp = ih.ih_next; + } + } + } #else nintr = (namelist[X_EINTRCNT].n_value - namelist[X_INTRCNT].n_value) / sizeof (int); *************** *** 638,643 **** --- 672,678 ---- size_t size; #if defined(__i386__) struct intrhand *intrhand[16], *ihp, ih; + struct intrhand *apicintrhand[256]; int i, n; #endif *************** *** 650,655 **** --- 685,701 ---- KREAD(ihp, &ih, sizeof(ih)); s->intrcnt[n++] = ih.ih_count; ihp = ih.ih_next; + } + } + if (namelist[X_APICINTRHAND].n_value) { + NREAD(X_APICINTRHAND, apicintrhand, sizeof(apicintrhand)); + for (i = 0, n = 0; i < 256; i++) { + ihp = apicintrhand[i]; + while (ihp) { + KREAD(ihp, &ih, sizeof(ih)); + s->intrcnt[n++] = ih.ih_count; + ihp = ih.ih_next; + } } } #else