Constantine A. Murenin wrote:
> You can't get them all at once with one sysctl(3) call, as the memory
> they occupy is not allocated continuously -- a linked list is used,
> and each driver does sensor allocation on its own, and it's not a
> sysctl(3) job to merge this linked list together into an array.
> 

Ah, thanks. From that perspective I can see that the use of the term
"array" in the sysctl(3) man page under HW_SENSORS doesn't necessarily
mean a literal array being written in the *oldp buffer; I hope the
confusion was at least understandable, though.

According to the source, `/sbin/sysctl hw.sensors` calls its own main
parsing routine 256 times to check each of the 256 possible sensors and
allocates its own list from the results. Eek. Since I'm just writing a
voltage monitor I suppose I could have it do that once on init and then
just monitor the specific sensors it finds relevant, assuming I can
convince myself that the numbers are assigned once at bootup (or at
least do not change once assigned).

Thanks again,
Weldon

Reply via email to