For Programmers: Free Programming Magazines  


Home > Archive > C > March 2004 > Limit to the length of argument list









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Limit to the length of argument list
mrby

2004-03-29, 12:30 am

Hi,

I wondered what is the exact meaning of the
system variable ARG_MAX. I got "1048320" by
running "getconf ARG_MAX" in my system. But
it reports "Arg list too long" when I ran a
command whose length is about 1044043.

So ... I want to know, what is the exact length limitation of the Unix
command? Is
it ARG_MAX plus something? If so, what is
this "something"?

thanks




Gordon Burditt

2004-03-29, 12:30 am

>I wondered what is the exact meaning of the
>system variable ARG_MAX. I got "1048320" by
>running "getconf ARG_MAX" in my system. But
>it reports "Arg list too long" when I ran a
>command whose length is about 1044043.
>
>So ... I want to know, what is the exact length limitation of the Unix
>command?


There may not *BE* an exact length limitation.

Chances are if you pass a large number of 0-length arguments, (say,
a billion or so) you will exceed a limit without actually having
any characters (except terminating \0s) at all. There may be a
limit on the size of the argv[] pointer array independent of the
characters.

Some lengths count only *AFTER* things like wildcard expansion,
shell variable substitution, etc. are done.

Shells may have their own limits, say, on the length of lines you
can use without using a continuation line.

Gordon L. Burditt
Jack Klein

2004-03-29, 1:30 am

On Mon, 29 Mar 2004 12:28:14 +0800, "mrby" <bianying@msn.com> wrote in
comp.lang.c:

> Hi,
>
> I wondered what is the exact meaning of the
> system variable ARG_MAX. I got "1048320" by
> running "getconf ARG_MAX" in my system. But
> it reports "Arg list too long" when I ran a
> command whose length is about 1044043.
>
> So ... I want to know, what is the exact length limitation of the Unix
> command? Is
> it ARG_MAX plus something? If so, what is
> this "something"?
>
> thanks


Since ARG_MAX is not a standard C macro, and UNIX commands have
nothing at all to do with the C language, I would suggest you find
someplace to ask this question where it is not off-topic.

news:comp.unix.programmer comes to mind.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~.../FAQ-acllc.html
Al Bowers

2004-03-29, 7:30 am



mrby wrote:
> Hi,
>
> I wondered what is the exact meaning of the
> system variable ARG_MAX. I got "1048320" by
> running "getconf ARG_MAX" in my system. But
> it reports "Arg list too long" when I ran a
> command whose length is about 1044043.
>
> So ... I want to know, what is the exact length limitation of the Unix
> command? Is
> it ARG_MAX plus something? If so, what is
> this "something"?
>



The Standary specifies that an implementation shall be
able to translate and execute at least one program
that contains at least one instance of 127 parameters
in one function definition


--
Al Bowers
Tampa, Fl USA
mailto: xabowers@myrapidsys.com (remove the x to send email)
http://www.geocities.com/abowers822/

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com