From owner-freebsd-current Fri Feb 5 21:26:23 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id VAA25747 for freebsd-current-outgoing; Fri, 5 Feb 1999 21:26:23 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.26.10.9]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id VAA25742 for ; Fri, 5 Feb 1999 21:26:20 -0800 (PST) (envelope-from bde@godzilla.zeta.org.au) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.7/8.8.7) id QAA10052; Sat, 6 Feb 1999 16:26:17 +1100 Date: Sat, 6 Feb 1999 16:26:17 +1100 From: Bruce Evans Message-Id: <199902060526.QAA10052@godzilla.zeta.org.au> To: dillon@apollo.backplane.com, wwoods@cybcon.com Subject: Re: Top not working in -Current?? Cc: bde@zeta.org.au, current@FreeBSD.ORG Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > This this patch to /usr/src/lib/libkvm/kvm_getswapinfo.c. Then > recompile libkvm and try top and pstat -s again. >Index: kvm_getswapinfo.c >=================================================================== >RCS file: /home/ncvs/src/lib/libkvm/kvm_getswapinfo.c,v >retrieving revision 1.4 >diff -u -r1.4 kvm_getswapinfo.c >--- kvm_getswapinfo.c 1999/01/27 11:29:15 1.4 >+++ kvm_getswapinfo.c 1999/02/06 04:46:48 >@@ -127,10 +127,10 @@ > KGET(NL_NSWDEV, nswdev); > KGET(NL_DMMAX, dmmax); > >- if (kvm_swap_nl[NL_SWAPLIST].n_value) >+ if (kvm_swap_nl[NL_SWAPLIST].n_type != N_UNDF) > type = 1; > >- if (kvm_swap_nl[NL_SWAPBLIST].n_value) >+ if (kvm_swap_nl[NL_SWAPBLIST].n_type != N_UNDF) > type = 2; > > /* >@@ -406,6 +406,13 @@ > struct blist blcopy = { 0 }; > > KGET(NL_SWAPBLIST, swapblist); >+ >+ if (swapblist == NULL) { >+ if (flags & SWIF_DUMP_TREE) >+ printf("radix tree: NULL - no swap in system\n"); >+ return; >+ } >+ > KGET2(swapblist, &blcopy, sizeof(blcopy), "*swapblist"); > > if (flags & SWIF_DUMP_TREE) { This needs more work - library routines shouldn't print to stdout or stderr, especially when there is a function like kvm_geterr() for reporting errors. - no swap is not an error. - top still gets a SIGFPE (the bug is in top -- it divides by swpary[0].ksw_total which may be 0). - pstat and systat have the same bug as top. - libkvm is still bloated with support for old swapping methods, despite more important parts of libkvm not working with kernels more than a few days old because the proc struct changed significantly. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message