Re: sysctl(3) and iteration over HW_SENSORS

2006-07-11 Thread Constantine A. Murenin
On 11/07/06, Weldon Goree <[EMAIL PROTECTED]> wrote: 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 Yes, I thought the same thing

Re: sysctl(3) and iteration over HW_SENSORS

2006-07-11 Thread Weldon Goree
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

Re: sysctl(3) and iteration over HW_SENSORS

2006-07-11 Thread Constantine A. Murenin
On 11/07/06, Weldon Goree <[EMAIL PROTECTED]> wrote: the buffer must hold? And how do I get all of them at once like (I think) sysctl(3) says I can? 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

Re: sysctl(3) and iteration over HW_SENSORS

2006-07-11 Thread Otto Moerbeek
On Mon, 10 Jul 2006, Weldon Goree wrote: > 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

sysctl(3) and iteration over HW_SENSORS

2006-07-10 Thread Weldon Goree
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 t