Review of the last few applied patches...

Bernhard Fischer rep.nop at aon.at
Sat May 20 01:38:09 UTC 2006


On Fri, May 19, 2006 at 05:42:39PM -0400, Rob Landley wrote:
>On Friday 19 May 2006 1:51 pm, Bernhard Fischer wrote:
>> On Fri, May 19, 2006 at 01:28:05PM -0400, Rob Landley wrote:
>> >Review of yesterday's committed patches...
>>
>> Rob, vodz correctly pointed out that we may have a problem with your fix
>> in readlink.c if BUFSIZ is too small -- much smaller than PATH_MAX.
>
>It's not ideal, true.  I'm still pondering a bb_realpath() that platform.h 
>either #defines as realpath() if it can handle NULL, or links to a libbb 
>function...

I think that would be the preferred solution.
>
>> On a related note..
>> I was thinking about making our internal BUFSIZ configurable via
>> "Busybox Library Tuning". What do you think?
>
>Is our BUFSIZ used for anything but the global common buffer?  I'm pondering 
>how to merge that in with the "union of global structures" thing I'm slowly 
>wandering twoards with sed.c and mdev.c...
>
>> PS:
>> Currently, there are alot of different sizes used, to name just a few:
>> decompress_bunzip2.c:#define IOBUF_SIZE 4096
>> sum.c:#define MY_BUF_SIZE 8192
>> pipe_progress.c:#define PIPE_PROGRESS_SIZE 4096
>> inetd.c:#define BUFSIZE 4096
>> httpd.c:# define PIPESIZE 4096
>
>Can these all be made to use bb_common_bufsiz1?  Or do they need a #define to 
>make their own buffer with?

I didn't look, but certainly not all. I take it that several could use
bb_common_bufsiz1, though.

May i suggest that you have a short look at a
make clean
make CFLAGS_EXTRA="-Wlarger-than-127"

Perhaps this turns up some offenders..
>
>4096 is PAGE_SIZE, and there's a real reason to have something be that size 

4096 can be PAGE_SIZE. It's 16k on e.g. ia64

>(access to that size chunks tends to be optimized on modern processors.  Of 
>course with malloc() overhead it probably tends to straddle pages anyway, 
>so...)

IFF we care about pagesize, then we should look at what
sysconf(_SC_PAGESIZE);
suggests and use that as base for the buffers.
>
>> Some of these are always for the same kind of uses (pipe, block I/O,
>> etc).
>
>Is there any way to do whatever they're doing in common code?  (Which may just 
>mean "use bb_common_bufsiz1 for the buffer".  (The outlier's 

Didn't look.

>decompress_bunzip2, which could potentially be called from some of the 
>others, and thus the two uses of the buffer stomp each other...)

Yes, that's a different kind of beast as far as the exact buffer which
is used is concerned. The *size* of the buffer used for
decompress_bunzip2 (et al) is a different question, and was really what
i ment to talk about :)



More information about the busybox mailing list