bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get the default value of --max-args?


From: Bernhard Voelker
Subject: Re: How to get the default value of --max-args?
Date: Thu, 8 Nov 2018 15:38:32 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

On 11/8/18 12:35 PM, Peng Yu wrote:
> Thanks. But I am not getting the same results (not the same number of
> echo's) as yours. I am using Mac OS X. Do you know why it is
> different?
> 
> $ xargs --show-limits < /dev/null
> Your environment variables take up 7701 bytes
> POSIX upper limit on argument length (this system): 252395
> POSIX smallest allowable upper limit on argument length (all systems): 4096
> Maximum length of command we could actually use: 244694
> Size of command buffer we are actually using: 131072
> Maximum parallelism (--max-procs must be no greater): 2147483647
> 
> $ yes . | head -n $(bc <<< '131072/2 - 3') | xargs -tn 200000 2>&1 |
> tr -d '[. ]'
> echo
> echo
> 
> echo
> 
> echo
> echo
> echo
> echo
> 
> echo
> 
> echo
> 
> $ yes . | head -n $(bc <<< '131072/2 - 2') | xargs -tn 200000 2>&1 |
> tr -d '[. ]'
> echo
> echo
> 
> echo
> 
> echo
> echo
> echo
> echo
> 
> echo
> 
> echo
> 

That also depends on a few other factors like .e.g. "env headroom', see
  https://git.sv.gnu.org/cgit/findutils.git/tree/xargs/xargs.c#n427
from line 427 until line 510.

I don't have Mac OS X, so I can't step through what's the limiting factor
in your case.

What's your actual concern?  I mean, depending on what COMMAND does, the
overhead of calling ~10 instead of 1 process in the ideal GNU/Linux case
for exactly that amount of arguments still looks okay to me.

Have a nice day,
Berny



reply via email to

[Prev in Thread] Current Thread [Next in Thread]