Date: Thu, 3 Mar 2011 09:49:48 -0800 From: David Wolfskill <david@catwhisker.org> To: hackers@freebsd.org Subject: Puzzled about VFS sysctl OIDs -- signed vs. unsigned Message-ID: <20110303174948.GF1471@albert.catwhisker.org>
next in thread | raw e-mail | index | archive | help
--/aVve/J9H4Wl5yVO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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: =2E.. static int getnewbufcalls; SYSCTL_INT(_vfs, OID_AUTO, getnewbufcalls, CTLFLAG_RW, &getnewbufcalls, 0, "Number of calls to getnewbuf"); =2E.. 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? If so, how should I interpret such negative values? [GSoC project, anyone?] Thanks! Peace, david --=20 David H. Wolfskill david@catwhisker.org Depriving a girl or boy of an opportunity for education is evil. See http://www.catwhisker.org/~david/publickey.gpg for my public key. --/aVve/J9H4Wl5yVO Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (FreeBSD) iEYEARECAAYFAk1v1LsACgkQmprOCmdXAD2RzgCfWovvxO4dXSqZWHB/4fgrZtap eMMAn0wbVs9/iNC0yepAiO5zSXYfG3zP =ttJq -----END PGP SIGNATURE----- --/aVve/J9H4Wl5yVO--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110303174948.GF1471>