[PATCH]: mpstat: code shrink

Denys Vlasenko vda.linux at googlemail.com
Fri Jul 30 14:44:17 UTC 2010


On Fri, Jul 30, 2010 at 10:40 AM, Marek Polacek <mmpolacek at gmail.com> wrote:
>  On 07/30/2010 04:06 AM, Denys Vlasenko wrote:
>>
>> On Thursday 22 July 2010 12:43, Marek Polacek wrote:
>>>
>>>   Currently we're determining the number of CPUs by the function
>>> get_cpu_nr() which in turn calls get_sys_cpu_nr() or even
>>> get_proc_cpu(). I think we could easily use sysconf(
>>> _SC_NPROCESSORS_CONF), and if this symbol isn't defined, then we'll read
>>> /proc/cpuinfo. This way we can get rid of those two not very pretty
>>> functions.
>>
>> Well, uh... uclibc unfortunately always returns 1
>> for _SC_NPROCESSORS_CONF...
>>
> Ah, didn't know that. That's mean.
>>
>> Reading lines into char buf[16] is buggy:
>> every line longer than 15 chars will get split into 15 char
>> chunks, which might cause misparsing and misdetection.
>>
> OK, here's another version -- it just removes function, which determines
> number of CPUs in /sys.

Applied, thanks!
-- 
vda


More information about the busybox mailing list