sysctl(3) says that sysctl({CTL_HW, HW_SENSORS}, 2, NULL, &some_size_t,
NULL, 0) should give me the size of the array of struct sensor's that
sysctl({CTL_HW, HW_SENSORS}, 2, &some_buffer, &length_thereof, NULL, 0)
will put into &some_buffer.
Or so I thought. In fact, it returns -1 and sets errno to ENOTDIR, which
it then diagnoses as my specifying a non-terminal MIB. sysctl(1) shows
me that I have 7 hw.sensors, but obviously that is a variable among
systems; how am I supposed to find the number of struct sensor's that
the buffer must hold? And how do I get all of them at once like (I
think) sysctl(3) says I can? Should I just run sysctl({CTL_HW,
HW_SENSORS, i}, 3 ...) for increasing values of i until it returns -1?
TIA,
Weldon