Allow choice of default arg size, Savannah bug #20594.

* configure.ac (DEFAULT_ARG_SIZE): Check environment for a default
size override.
* lib/buildcmd.c (bc_use_sensible_arg_max): Use default size from
configure, if requested.
* README (DEFAULT_ARG_SIZE): Mention the ability to tune this at
configure time.
* NEWS: Document the change.
This commit is contained in:
Eric Blake 2007-08-01 03:39:57 +00:00
parent b4285d0eb0
commit 756cecd45b
5 changed files with 44 additions and 10 deletions

View File

@ -1,3 +1,14 @@
2007-07-31 Eric Blake <ebb9@byu.net>
Allow choice of default arg size, Savannah bug #20594.
* configure.ac (DEFAULT_ARG_SIZE): Check environment for a default
size override.
* lib/buildcmd.c (bc_use_sensible_arg_max): Use default size from
configure, if requested.
* README (DEFAULT_ARG_SIZE): Mention the ability to tune this at
configure time.
* NEWS: Document the change.
2007-07-29 James Youngman <jay@gnu.org>
* tr.po: Updated from Translation Project.

6
NEWS
View File

@ -7,6 +7,7 @@ Findutils version 4.3.9 is released under version 3 of the GNU General
Public License.
** Bug Fixes
#20310: configure uses hosts's support status for "sort -z" when
generating the updatedb script for use on the target. This is
inappropriate when cross-compiling, so avoid doing that.
@ -26,6 +27,11 @@ does not follow the POSIX rules of doing likewise.
updatedb, frcode and code now complies with the GNU Project's coding
standards.
** Enhancements
#20594: Allow fine-tuning of the default argument size used by xargs
and find at ./configure time.
** Documentation Fixes
Point out more explicitly that the subsecond timestamp support

7
README
View File

@ -36,6 +36,13 @@ doing. This information includes details about how the command line
has been parsed and what files have been stat()ed. This output is
normally interesting only to the maintainer, and so is off by default.
DEFAULT_ARG_SIZE=<value>
If this environment variable is defined to a numeric expression
during configure, it determines the default argument size limits used
by xargs without -s, and by find, when spawning child processes.
Otherwise, the default is set at 128 kibibytes. If the system cannot
support the default limit, the system's limit will be used instead.
To gain speed, GNU find avoids statting files whenever possible.
It does this by:

View File

@ -36,7 +36,7 @@ AC_ARG_ENABLE(d_type-optimization,
AS_HELP_STRING(--enable-d_type-optimization,Make use of the file type data returned in struct dirent.d_type by readdir()),
[ac_cv_d_type=$enableval],[ac_cv_d_type=yes])
dnl This one has no default, because otherwise we would have to say
dnl This one has no default, because otherwise we would have to say
dnl both --enable-d_type-optimisation=no and --enable-d_type-optimization=no
dnl to turn it off.
AC_ARG_ENABLE(d_type-optimisation,
@ -61,6 +61,13 @@ else
AC_DEFINE(LEAF_OPTIMISATION, 1, [Define if you want to use the leaf optimisation (this can still be turned off with -noleaf)])
fi
AC_ARG_VAR([DEFAULT_ARG_SIZE], [Default size of arguments to child processes
of find and xargs, 128k if unspecified])
if test -n "$DEFAULT_ARG_SIZE"; then
AC_DEFINE_UNQUOTED([DEFAULT_ARG_SIZE], [$DEFAULT_ARG_SIZE],
[If defined, the default argument size used in child processes])
fi
dnl Checks for programs.
@ -91,19 +98,19 @@ gl_INIT
dnl Older versions of gnulib/m4/nls.m4 provide AM_MKINSTALLDIRS.
dnl The current version of gnulib does not, but the version of
dnl The current version of gnulib does not, but the version of
dnl po/Makefile.in.in that comes with gettext-0.14.6 expects
dnl that @MKINSTALLDIRS@ will be expanded.
AM_MKINSTALLDIRS
dnl lib/regexprops needs to be a native program, because we need to
dnl lib/regexprops needs to be a native program, because we need to
dnl run it in order to generate the documentation about the properties
dnl of regular expressions. See lib/Makefile.am.
AM_CONDITIONAL(CROSS_COMPILING, [[test "x$cross_compiling" = xyes]])
dnl Try to get a POSIX.1 environment.
dnl Checks for libraries. If getpwnam() isn't present in the
dnl Checks for libraries. If getpwnam() isn't present in the
dnl C library, try -lsun.
AC_CHECK_FUNC(getpwnam, [],
[AC_CHECK_LIB(sun, getpwnam)])
@ -167,8 +174,8 @@ AC_FUNC_VPRINTF
AC_FUNC_ALLOCA
AC_FUNC_CLOSEDIR_VOID
dnl We don't just use AC_FUNC_GETMNTENT directly because it
dnl will try to use -lsun on platforms which have getmntent() in the
dnl We don't just use AC_FUNC_GETMNTENT directly because it
dnl will try to use -lsun on platforms which have getmntent() in the
dnl C library, for example UNICOS.
AC_CHECK_FUNC(getmntent, [], [AC_FUNC_GETMNTENT])
AC_CHECK_FUNCS(getmntent)
@ -218,7 +225,7 @@ jy_AC_TYPE_INTMAX_T
jy_SORTZ
AC_CHECK_MEMBER(struct dirent.d_type,,,[
AC_CHECK_MEMBER(struct dirent.d_type,,,[
#include <sys/types.h>
#include <dirent.h>])
@ -241,7 +248,7 @@ AC_DEFINE([ALREADY_INCLUDED_CONFIG_H], 1, [Define so that source code can verify
##AC_CONFIG_SUBDIRS(gnulib)
AC_CONFIG_FILES(gnulib/Makefile gnulib/lib/Makefile)
AC_CONFIG_FILES(m4/Makefile)
AC_CONFIG_FILES([Makefile
AC_CONFIG_FILES([Makefile
tests/Makefile build-aux/Makefile
find/Makefile find/testsuite/Makefile
xargs/Makefile xargs/testsuite/Makefile

View File

@ -500,8 +500,12 @@ bc_init_controlinfo(struct buildcmd_control *ctl,
void
bc_use_sensible_arg_max(struct buildcmd_control *ctl)
{
#ifdef DEFAULT_ARG_SIZE
enum { arg_size = DEFAULT_ARG_SIZE };
#else
enum { arg_size = (128u * 1024u) };
#endif
/* Check against the upper and lower limits. */
if (arg_size > ctl->posix_arg_size_max)
ctl->arg_max = ctl->posix_arg_size_max;
@ -547,4 +551,3 @@ bc_clear_args(const struct buildcmd_control *ctl,
state->todo = 0;
state->dirfd = -1;
}