From owner-freebsd-ports-bugs@FreeBSD.ORG Thu May 12 23:10:02 2005 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9B5F416A4CE for ; Thu, 12 May 2005 23:10:02 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 63DD143D5E for ; Thu, 12 May 2005 23:10:02 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j4CNA2iS077347 for ; Thu, 12 May 2005 23:10:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j4CNA2Su077346; Thu, 12 May 2005 23:10:02 GMT (envelope-from gnats) Resent-Date: Thu, 12 May 2005 23:10:02 GMT Resent-Message-Id: <200505122310.j4CNA2Su077346@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Ted Faber Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 300CF16A4CE for ; Thu, 12 May 2005 23:09:50 +0000 (GMT) Received: from pun.isi.edu (pun.isi.edu [128.9.160.150]) by mx1.FreeBSD.org (Postfix) with ESMTP id BEEDD43D82 for ; Thu, 12 May 2005 23:09:49 +0000 (GMT) (envelope-from faber@pun.isi.edu) Received: from pun.isi.edu (localhost [127.0.0.1]) by pun.isi.edu (8.13.3/8.13.1) with ESMTP id j4CN9nQc002831; Thu, 12 May 2005 16:09:49 -0700 (PDT) (envelope-from faber@pun.isi.edu) Received: (from faber@localhost) by pun.isi.edu (8.13.3/8.13.1/Submit) id j4CN9nWu002830; Thu, 12 May 2005 16:09:49 -0700 (PDT) (envelope-from faber) Message-Id: <200505122309.j4CN9nWu002830@pun.isi.edu> Date: Thu, 12 May 2005 16:09:49 -0700 (PDT) From: Ted Faber To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 cc: faber@isi.edu Subject: ports/80954: xsysinfo fix for changed kernel variable name (patch) X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Ted Faber List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2005 23:10:02 -0000 >Number: 80954 >Category: ports >Synopsis: xsysinfo fix for changed kernel variable name (patch) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu May 12 23:10:01 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Ted Faber >Release: FreeBSD 6.0-CURRENT i386 >Organization: USC/ISI >Environment: System: FreeBSD pun.isi.edu 6.0-CURRENT FreeBSD 6.0-CURRENT #2: Mon May 9 13:24:00 PDT 2005 root@pun.isi.edu:/usr/obj/usr/src/sys/PUN i386 >Description: xsysinfo has failed at run time since the 1.260 update to /sys/kern/kern_discrip.c that changed nfiles to openfiles. This patch fixes the error in a quick and dirty way. (I didn't get rid of using nlist or anything radical). The chage is keyed on a __FreeBSD_version__ value that almost but not quite matches the date of the variable name change. Patch attached. >How-To-Repeat: N/A >Fix: diff -ruN xsysinfo.bak/files/patch-sysinfo.c xsysinfo/files/patch-sysinfo.c --- xsysinfo.bak/files/patch-sysinfo.c Sun Sep 5 13:31:29 2004 +++ xsysinfo/files/patch-sysinfo.c Thu May 12 15:52:36 2005 @@ -1,8 +1,5 @@ - -$FreeBSD: ports/sysutils/xsysinfo/files/patch-sysinfo.c,v 1.2 2004/09/05 20:31:29 krion Exp $ - ---- sysinfo.c.orig Tue Oct 6 16:21:18 1998 -+++ sysinfo.c Sun Sep 5 22:30:23 2004 +--- sysinfo.c.orig Tue Oct 6 07:21:18 1998 ++++ sysinfo.c Thu May 12 15:49:32 2005 @@ -13,7 +13,9 @@ #include /* XXX NTTYDISC is too well hidden */ #include @@ -46,7 +43,7 @@ #define VM_SWAPLIST 1 { "_swaplist" },/* list of free swap areas */ #define VM_SWDEVT 2 -@@ -129,6 +141,27 @@ +@@ -129,6 +141,32 @@ #define X_DKXFER 12 { "_dk_xfer" }, #endif @@ -58,7 +55,12 @@ +#define V_NUMV 3 + { "_numvnodes" }, +#define FNL_NFILE 4 ++/* nfiles changes name to openfiles near this FreeBSD version */ ++#if __FreeBSD_version > 503101 ++ {"_openfiles"}, ++#else + {"_nfiles"}, ++#endif +#define FNL_MAXFILE 5 + {"_maxfiles"}, +#define NLMANDATORY FNL_MAXFILE /* names up to here are mandatory */ @@ -74,7 +76,7 @@ { "" }, }; -@@ -238,6 +271,14 @@ +@@ -238,6 +276,14 @@ int pkt_in_out; int total_xfers=0; int mib[3], size; @@ -89,7 +91,7 @@ /* NPROCS=0, CPU */ if (cpuflag) { -@@ -356,19 +397,30 @@ +@@ -356,19 +402,30 @@ for (i=0; i<10; i++) states[i] = 0; size = sizeof(nfsstats); @@ -123,7 +125,7 @@ else { old_nfsStats = nfsStats; -@@ -395,6 +447,22 @@ +@@ -395,6 +452,22 @@ #else nfsstats.rpccnt[NFSPROC_READDIR]; #endif @@ -146,7 +148,7 @@ nfsStats.nfsServer = nfsstats.srvrpccnt[NFSPROC_GETATTR] + nfsstats.srvrpccnt[NFSPROC_SETATTR] + nfsstats.srvrpccnt[NFSPROC_LOOKUP] + -@@ -418,6 +486,7 @@ +@@ -418,6 +491,7 @@ #else nfsstats.srvrpccnt[NFSPROC_READDIR]; #endif @@ -154,7 +156,7 @@ } scale_bar(250, nfsStats.nfsClient-old_nfsStats.nfsClient, 25, states, 0); draw_bar(nfsflag-1, states, 10); -@@ -428,7 +497,7 @@ +@@ -428,7 +502,7 @@ } nfs_out: @@ -163,7 +165,7 @@ /* swapmode is derived from freebsd's pstat source ... -@@ -438,6 +507,21 @@ +@@ -438,6 +512,21 @@ void swapmode(int *used, int *avail) { @@ -185,7 +187,7 @@ char *header; int hlen, nswap, nswdev, dmmax; int i, div, nfree, npfree; -@@ -546,6 +630,7 @@ +@@ -546,6 +635,7 @@ *used = *avail - nfree; free(sw); free(perdev); @@ -193,7 +195,7 @@ } /* -@@ -623,13 +708,21 @@ +@@ -623,13 +713,21 @@ * Make sure that the userland devstat version matches the kernel * devstat version. */ @@ -215,7 +217,7 @@ nodisk++; return; } -@@ -644,7 +737,11 @@ +@@ -644,7 +742,11 @@ * changed here, since it almost certainly has. We only look for * errors. */ @@ -227,7 +229,7 @@ nodisk++; return; } -@@ -656,7 +753,11 @@ +@@ -656,7 +758,11 @@ /* only interested in disks */ matches = NULL; @@ -239,7 +241,7 @@ nodisk++; return; } -@@ -671,7 +772,11 @@ +@@ -671,7 +777,11 @@ * device list has changed, so we don't look for return values of 0 * or 1. If we get back -1, though, there is an error. */ @@ -251,7 +253,7 @@ &num_selections, &select_generation, generation, cur.dinfo->devices, num_devices, matches, num_matches, -@@ -697,7 +802,11 @@ +@@ -697,7 +807,11 @@ * the selection process again, in case a device that we * were previously displaying has gone away. */ @@ -263,7 +265,7 @@ case -1: return (0); case 1: { -@@ -705,7 +814,11 @@ +@@ -705,7 +819,11 @@ num_devices = cur.dinfo->numdevs; generation = cur.dinfo->generation; @@ -275,7 +277,7 @@ &num_selections, &select_generation, generation, cur.dinfo->devices, num_devices, matches, num_matches, -@@ -729,14 +842,22 @@ +@@ -729,14 +847,22 @@ * Calculate elapsed time up front, since it's the same for all * devices. */ @@ -298,7 +300,7 @@ return (0); } -@@ -764,7 +885,11 @@ +@@ -764,7 +890,11 @@ last.dinfo = cur.dinfo; cur.dinfo = tmp_dinfo; >Release-Note: >Audit-Trail: >Unformatted: