Subject: misc/23190: sysctl(3) manpage has wrong data type for KERN_CP_TIME
To: None <>
From: None <>
List: netbsd-bugs
Date: 10/19/2003 01:46:40
>Number:         23190
>Category:       misc
>Synopsis:       sysctl(3) manpage has wrong data type for KERN_CP_TIME
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    misc-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 19 01:47:00 UTC 2003
>Originator:     Adam Sampson
>Release:        1.6
NetBSD mcnaught 1.6 NetBSD 1.6 (GENERIC) #0: Sun Sep  8 19:43:40 UTC 2002 i386

I'm porting libstatgrab to NetBSD at the moment, and I'm writing some code that uses sysctl() to read the CPU times vector. The sysctl(3) manual page says that KERN_CP_TIME's return data type is an array of CPUSTATES longs, but this won't work; it's actually an array of CPUSTATES u_int16_ts (as looking at the sysctl(8) source confirmed). There's also a couple of obvious typos in the description.
"man 3 sysctl", search for "CP_TIME".
Change the "Type" of KERN_CP_TIME in the CTL_KERN table to "u_int64_t[]", and the description below to something like:

"An array of CPUSTATES u_int16_t values is returned. This array contains the number of clock ticks spent in different CPU states."