From owner-freebsd-hackers@FreeBSD.ORG Thu Mar 3 21:25:25 2011 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCD73106564A for ; Thu, 3 Mar 2011 21:25:25 +0000 (UTC) (envelope-from jamesbrandongooch@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 729F18FC08 for ; Thu, 3 Mar 2011 21:25:25 +0000 (UTC) Received: by wyb32 with SMTP id 32so1748778wyb.13 for ; Thu, 03 Mar 2011 13:25:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=n0BJFGndIeERCyOrcFomQdaa44YY2c/79dopjwxAs70=; b=Vo7ss05+AsnNm3EMGeVujmkIm9B/OrPnOyaY2iUqPJctwUuqY6gpy4m5syi4XCFvn2 sl67UaYeoQdvF8tnGCp6rPE2vDTDV0sE6/VuGB7dmAmyFpS6SSts7dYBr/fq4adHzjGx FHiOrPujDx4cgCIQVTjWAVsQg0VaeibJW2O9c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=P9ci+bOxQEHuM9FzA20ppxpW01679z8QJbtHwlcsYH+orcMjNAFJWXQ36Gyj+7ZNH/ Mm3qTI4KqvWwfWN9r+AstkXJ8kRkghvqnYhfRKsqfDPU88wpVivE2P5kDnBkOnHkFAEo 6TnSUT7YxU98l4u6o/hFPV0dRz8CSvaDZVMkg= MIME-Version: 1.0 Received: by 10.216.141.16 with SMTP id f16mr1254608wej.80.1299186182456; Thu, 03 Mar 2011 13:03:02 -0800 (PST) Received: by 10.216.25.72 with HTTP; Thu, 3 Mar 2011 13:03:02 -0800 (PST) In-Reply-To: <20110303174948.GF1471@albert.catwhisker.org> References: <20110303174948.GF1471@albert.catwhisker.org> Date: Thu, 3 Mar 2011 15:03:02 -0600 Message-ID: From: Brandon Gooch To: David Wolfskill Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: hackers@freebsd.org Subject: Re: Puzzled about VFS sysctl OIDs -- signed vs. unsigned X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Mar 2011 21:25:25 -0000 On Thu, Mar 3, 2011 at 11:49 AM, David Wolfskill wro= te: > I'm using a little shell script to capture selected sysctl OID > values periodically, in an attempt to get a better idea how the > resources of a system are being used during a long-running (usually > measured in hours), mission-critical workload. > > In the process of testing this, I've seen some of the VFS sysctl > OIDs (in particular) report negative values ... when the description > looks to me as if the OID in question is intended to be a monotonically > increasing counter. > > For example: > >> sysctl -d vfs.getnewbufcalls > vfs.getnewbufcalls: Number of calls to getnewbuf >> sysctl vfs.getnewbufcalls > vfs.getnewbufcalls: -348909432 > > Examining sys/kern/vfs_bio.c, the definition of vfs.getnewbufcalls > appears to be: > > ... > static int getnewbufcalls; > SYSCTL_INT(_vfs, OID_AUTO, getnewbufcalls, CTLFLAG_RW, &getnewbufcalls, 0= , > =A0 "Number of calls to getnewbuf"); > ... > > Many of the other OIDs defined nearby are also SYSCTL_INT (or > SYSCTL_LONG), vs. SYSCTL_UINT (or SYSCTL_ULONG), and the corresponding > variables are defined as static int (or static long) vs. static u_int > (or static u_long). > > Is this both correct and reasonable? =A0If so, how should I interpret suc= h > negative values? > > [GSoC project, anyone?] > > Thanks! > > Peace, > david The following initiative may factor heavily into any decision to change sysctl declarations at this point: http://www.freebsd.org/news/status/report-2010-10-2010-12.html#SYSCTL-Type-= Safety I don't pretend to fully understand the reasons or impact of this project, but I have to imagine that at least the scope is similar to a proposed GSoC project (probably bigger). -Brandon