[PATCH 1/2] find: use sysconf(_SC_ARG_MAX) to determine the command-line size limit

Bartosz Gołaszewski bartekgola at gmail.com
Wed Nov 26 14:49:48 UTC 2014


2014-11-26 15:21 GMT+01:00 Denys Vlasenko <vda.linux at googlemail.com>:
> On Thu, Jul 3, 2014 at 2:27 PM, Bartosz Gołaszewski
> <bartekgola at gmail.com> wrote:
>> have you read my message from June 10th in this thread? Could you
>> review the patches I attached back then? Busybox still uses ARG_MAX as
>> default, which is smaller than sysconf(_SC_ARG_MAX) on every system I
>> checked. In fact commit 5aeae36 isn't even needed if we switch to
>> using sysconf() as default.
>
> I am using an uclibc-based toolchain and it has ARG_MAX of 126k.
> (It's sysconf(_SC_ARG_MAX) is 128k, btw, and I don't need to
> include linux/limits.h to get it.)
>
> The case where ARG_MAX is in use gives a small size advantage
> (eliminates a function call). I would like to preserve that.
>
> With sufficiently large ARG_MAX, further wins from sysconf(_SC_ARG_MAX)
> being bigger than it are exponentially smaller:
> you can see 4 times fewer fork+execs, but when each execed process
> already takes a thousand parameters it's likely execution time is dominated
> by what that process does with each parameter.
>
> I pushed a change which attempts to find a balance.
> Please take a look at current git.

Thanks, that should do it. What about the second patch (the comment is
no longer valid though, as the largest ARG_MAX we can get is much less
now)? (http://lists.busybox.net/pipermail/busybox/attachments/20140623/09dc689b/attachment.obj)

If I'll find the time, I'll try and implement the growable buffer then.

Bartosz Golaszewski


More information about the busybox mailing list