aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2014-06-22 13:54:40 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2014-06-22 13:54:40 +0200
commitf92f1d0181853b989f9377debb56902e3e21c9a8 (patch)
tree14c0bb888dea4b92e0f8dcaec2aa9c2a40eb3966 /libbb
parent6be3a5242ce4855734a4cdd5770b6ea7adaf2b3d (diff)
downloadbusybox-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 'libbb')
-rw-r--r--libbb/Kbuild.src1
-rw-r--r--libbb/sysconf.c16
2 files changed, 17 insertions, 0 deletions
diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src
index 6578d1171..62680bd52 100644
--- a/libbb/Kbuild.src
+++ b/libbb/Kbuild.src
@@ -92,6 +92,7 @@ lib-y += skip_whitespace.o
92lib-y += speed_table.o 92lib-y += speed_table.o
93lib-y += str_tolower.o 93lib-y += str_tolower.o
94lib-y += strrstr.o 94lib-y += strrstr.o
95lib-y += sysconf.o
95lib-y += time.o 96lib-y += time.o
96lib-y += trim.o 97lib-y += trim.o
97lib-y += u_signal_names.o 98lib-y += u_signal_names.o
diff --git a/libbb/sysconf.c b/libbb/sysconf.c
new file mode 100644
index 000000000..c5fa5e001
--- /dev/null
+++ b/libbb/sysconf.c
@@ -0,0 +1,16 @@
1/* vi: set sw=4 ts=4: */
2/*
3 * Various system configuration helpers.
4 *
5 * Copyright (C) 2014 Bartosz Golaszewski <bartekgola@gmail.com>
6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */
9#include "libbb.h"
10
11#if defined _SC_ARG_MAX
12unsigned FAST_FUNC bb_arg_max(void)
13{
14 return sysconf(_SC_ARG_MAX);
15}
16#endif