summaryrefslogtreecommitdiff
path: root/libbb/sysconf.c
Commit message (Collapse)AuthorAgeFilesLines
* libbb: add sanity check in bb_arg_max()Denys Vlasenko2014-12-241-1/+9
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: use ARG_MAX for bb_arg_max() only if it's 60k+Denys Vlasenko2014-11-261-1/+1
| | | | | | | | | | | | | | | | | Sometimes ARG_MAX is small (like 32k) yet sysconf(_SC_ARG_MAX) is big, and people prefer using the bigger value. OTOH, with sufficiently large ARG_MAX, further wins from sysconf(_SC_ARG_MAX) being bigger are exponentially smaller: you can see 4 times fewer fork+execs when you run find, 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. Thus, with this change ARG_MAX is used if it's sufficiently big, otherwise sysconf(_SC_ARG_MAX) is used. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: fix compile failure if both ARG_MAX and _SC_ARG_MAX are definedDenys Vlasenko2014-06-251-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: use a wrapper around sysconf(_SC_CLK_TCK) to save a few bytesBartosz Golaszewski2014-06-221-0/+6
| | | | | | | | | | | | | | function old new delta bb_sc_clk_tck - 10 +10 timescmd 118 113 -5 print_route 1763 1758 -5 mpstat_main 1288 1283 -5 iostat_main 1947 1942 -5 INET_setroute 879 871 -8 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/5 up/down: 10/-28) Total: -18 bytes Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* find: use sysconf(_SC_ARG_MAX) to determine the command-line size limitDenys Vlasenko2014-06-221-0/+16
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>