[PATCH]: mpstat: code shrink

Denys Vlasenko vda.linux at googlemail.com
Fri Jul 30 02:06:38 UTC 2010


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...

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.

-- 
vda



More information about the busybox mailing list