diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2014-06-22 13:54:40 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2014-06-22 13:54:40 +0200 |
commit | f92f1d0181853b989f9377debb56902e3e21c9a8 (patch) | |
tree | 14c0bb888dea4b92e0f8dcaec2aa9c2a40eb3966 /include | |
parent | 6be3a5242ce4855734a4cdd5770b6ea7adaf2b3d (diff) | |
download | busybox-w32-f92f1d0181853b989f9377debb56902e3e21c9a8.tar.gz busybox-w32-f92f1d0181853b989f9377debb56902e3e21c9a8.tar.bz2 busybox-w32-f92f1d0181853b989f9377debb56902e3e21c9a8.zip |
find: use sysconf(_SC_ARG_MAX) to determine the command-line size limit
The find utility uses a hardcoded value of 32 * 1024 as the limit of
the command-line length when calling 'find -exec ... {} +'. This results
in over 4 times more execve() calls than in coreutils' find.
This patch uses the limit defined in system headers.
Based on the patch by Bartosz Golaszewski <bartekgola@gmail.com>.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/libbb.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/libbb.h b/include/libbb.h index a1a0dc18c..fa69a7fe6 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -731,6 +731,14 @@ extern void *xmalloc_open_read_close(const char *filename, size_t *maxsz_p) FAST | |||
731 | /* Never returns NULL */ | 731 | /* Never returns NULL */ |
732 | extern void *xmalloc_xopen_read_close(const char *filename, size_t *maxsz_p) FAST_FUNC RETURNS_MALLOC; | 732 | extern void *xmalloc_xopen_read_close(const char *filename, size_t *maxsz_p) FAST_FUNC RETURNS_MALLOC; |
733 | 733 | ||
734 | #if defined ARG_MAX | ||
735 | # define bb_arg_max() ((unsigned)ARG_MAX) | ||
736 | #elif defined _SC_ARG_MAX | ||
737 | unsigned bb_arg_max(void) FAST_FUNC; | ||
738 | #else | ||
739 | # define bb_arg_max() ((unsigned)(32 * 1024)) | ||
740 | #endif | ||
741 | |||
734 | #define SEAMLESS_COMPRESSION (0 \ | 742 | #define SEAMLESS_COMPRESSION (0 \ |
735 | || ENABLE_FEATURE_SEAMLESS_XZ \ | 743 | || ENABLE_FEATURE_SEAMLESS_XZ \ |
736 | || ENABLE_FEATURE_SEAMLESS_LZMA \ | 744 | || ENABLE_FEATURE_SEAMLESS_LZMA \ |