Date: Thu, 11 Sep 1997 14:18:25 +0200 (METDST) From: Robert Hoehne To: Oberhumer Markus Cc: Eli Zaretskii , djgpp-workers AT delorie DOT com Subject: Re: c1args.c patches In-Reply-To: <199709101444.KAA20690@delorie.com> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Wed, 10 Sep 1997, Oberhumer Markus wrote: > xargs has the annoying limitation of the size of the transfer buffer Oh No!! It is not the limited tarnsfer buffer but the way like xargs is designed. It is probaly the only program currently in use on DJGPP which examines the system limitation for the maximal argument lenght. And this is for DJGPP 4096!! Here is the relevant part from xargs.c which shows this: ----------------- orig_arg_max = ARG_MAX - 2048; /* POSIX.2 requires subtracting 2048. */ arg_max = orig_arg_max; /* Sanity check for systems with huge ARG_MAX defines (e.g., Suns which have it at 1 meg). Things will work fine with a large ARG_MAX but it will probably hurt the system more than it needs to; an array of this size is allocated. */ if (arg_max > 20 * 1024) arg_max = 20 * 1024; /* Take the size of the environment into account. */ arg_max -= env_size (environ); if (arg_max <= 0) error (1, 0, "environment is too large for exec"); ------------------ And here is now the patch for limits.h, by adjusting this value to the current used transfer buffer size: --- include/limits.h~ Wed Jul 2 22:13:44 1997 +++ include/limits.h Thu Sep 11 08:16:32 1997 @@ -27,7 +27,7 @@ #ifndef __STRICT_ANSI__ -#define _POSIX_ARG_MAX 4096 /* but only for exec's to other djgpp programs */ +#define _POSIX_ARG_MAX 16384 /* but only for exec's to other djgpp programs */ #define _POSIX_CHILD_MAX 6 /* really limited by memory */ #define _POSIX_LINK_MAX 1 /* POSIX says 8, but DOS says 1 */ #define _POSIX_MAX_CANON 126 /* POSIX says 255, but DOS says 126 */ @@ -43,7 +43,7 @@ #define NGROUPS_MAX 0 -#define ARG_MAX 4096 +#define ARG_MAX 16384 #define CHILD_MAX 6 /* #define OPEN_MAX 20 - DOS can change this */ /* #define STREAM_MAX 20 - DOS can change this */ Of course, when the tb size will change (the default) in the next DJGPP evrsion, this should be reflected here too. Robert