From owner-freebsd-stable@FreeBSD.ORG Thu Apr 24 08:02:51 2008 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D9B7106566C for ; Thu, 24 Apr 2008 08:02:51 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from cs1.cs.huji.ac.il (cs1.cs.huji.ac.il [132.65.16.10]) by mx1.freebsd.org (Postfix) with ESMTP id D2A908FC1B for ; Thu, 24 Apr 2008 08:02:50 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from pampa.cs.huji.ac.il ([132.65.80.32]) by cs1.cs.huji.ac.il with esmtp id 1JowPp-0004H5-7T; Thu, 24 Apr 2008 11:02:49 +0300 X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.2 To: Dan Nelson In-reply-to: <20080424013421.GF99910@dan.emsphone.com> References: <20080424013421.GF99910@dan.emsphone.com> Comments: In-reply-to Dan Nelson message dated "Wed, 23 Apr 2008 20:34:21 -0500." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 24 Apr 2008 11:02:49 +0300 From: Danny Braniss Message-ID: Cc: freebsd-stable@freebsd.org, Tim Stoddard Subject: Re: auto_nlist failed on cp_time at location 1 X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Apr 2008 08:02:51 -0000 > > --dc+cDN39EJAMEtIO > Content-Type: text/plain; charset=us-ascii > Content-Disposition: inline > > In the last episode (Apr 23), Tim Stoddard said: > > I just upgraded from FreeBSD 6.2 -> > > 6.3 (using source tree). I then recompiled my net-snmp port binaries (using > > portupgrade). I am now get error message in my logs every five secs. > > I am sure my libkvm is in sync with my kernel. I do not know what else > > to look at. > > You got bit by > > revision 1.178.2.5 > date: 2008/04/09 19:47:20; author: peter; state: Exp; lines: +68 -5 > MFC: record per-cpu stats for %user/%nice/%system/%idle > > , which removed the kernel variable that net-snmp uses to track CPU > usage. Try this patch (put it in /usr/ports/net-mgmt/net-snmp/files and > rebuild net-snmp). I've sent it to the net-snmp port maintainer so > hopefully it will be committed soon. > > -- > Dan Nelson > dnelson@allantgroup.com > the same goes for rpc.rstatd :-), see http://www.freebsd.org/cgi/query-pr.cgi?pr=123014 > --dc+cDN39EJAMEtIO > Content-Type: text/plain; charset=us-ascii > Content-Disposition: attachment; filename="patch-cpu_nlist.c" > > --- agent/mibgroup/hardware/cpu/cpu_nlist.c 2007-01-19 10:53:44.000000000 -0600 > +++ agent/mibgroup/hardware/cpu/cpu_nlist.c 2008-04-22 00:13:48.330686919 -0500 > @@ -1,5 +1,5 @@ > /* > - * nlist() interface > + * sysctl() interface > * e.g. FreeBSD > */ > #include > @@ -12,24 +12,9 @@ > #include > #include > > -#ifdef HAVE_SYS_DKSTAT_H > -#include > -#endif > #ifdef HAVE_SYS_SYSCTL_H > #include > #endif > -#ifdef HAVE_SYS_VMMETER_H > -#include > -#endif > -#ifdef HAVE_VM_VM_PARAM_H > -#include > -#endif > -#ifdef HAVE_VM_VM_EXTERN_H > -#include > -#endif > - > -#define CPU_SYMBOL "cp_time" > -#define MEM_SYMBOL "cnt" > > void _cpu_copy_stats( netsnmp_cpu_info *cpu ); > > @@ -67,11 +52,12 @@ > */ > int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) { > long cpu_stats[CPUSTATES]; > - struct vmmeter mem_stats; > + int size, tempval; > + > netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 0 ); > > - auto_nlist( CPU_SYMBOL, (char *) cpu_stats, sizeof(cpu_stats)); > - auto_nlist( MEM_SYMBOL, (char *)&mem_stats, sizeof(mem_stats)); > + size = sizeof(cpu_stats); > + sysctlbyname("kern.cp_time", &cpu_stats, &size, NULL, 0); > > cpu->user_ticks = (unsigned long)cpu_stats[CP_USER]; > cpu->nice_ticks = (unsigned long)cpu_stats[CP_NICE]; > @@ -85,15 +71,19 @@ > * Interrupt/Context Switch statistics > * XXX - Do these really belong here ? > */ > -#if defined(openbsd2) || defined(darwin) > - cpu->swapIn = (unsigned long)mem_stats.v_swpin; > - cpu->swapOut = (unsigned long)mem_stats.v_swpout; > -#else > - cpu->swapIn = (unsigned long)mem_stats.v_swappgsin+mem_stats.v_vnodepgsin; > - cpu->swapOut = (unsigned long)mem_stats.v_swappgsout+mem_stats.v_vnodepgsout; > -#endif > - cpu->nInterrupts = (unsigned long)mem_stats.v_intr; > - cpu->nCtxSwitches = (unsigned long)mem_stats.v_swtch; > + size = sizeof(int); > +#define GET_VM_STATS(cat, name, netsnmpname) \ > + do { \ > + sysctlbyname("vm.stats." #cat "." #name, &tempval, &size, NULL, 0); \ > + cpu->netsnmpname = (unsigned long) tempval; \ > + } while(0) > + > + GET_VM_STATS(vm, v_swappgsin, swapIn); > + GET_VM_STATS(vm, v_swappgsout, swapOut); > + GET_VM_STATS(vm, v_vnodepgsin, pageIn); > + GET_VM_STATS(vm, v_vnodepgsout, pageOut); > + GET_VM_STATS(sys, v_intr, nInterrupts); > + GET_VM_STATS(sys, v_swtch, nCtxSwitches); > > #ifdef PER_CPU_INFO > for ( i = 0; i < n; i++ ) { > > --dc+cDN39EJAMEtIO > Content-Type: text/plain; charset="us-ascii" > MIME-Version: 1.0 > Content-Transfer-Encoding: 7bit > Content-Disposition: inline > > _______________________________________________ > freebsd-stable@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-stable > To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org" > --dc+cDN39EJAMEtIO-- >