Discussion:
[9fans] ARG_MAX of Plan9
(too old to reply)
arisawa
2012-05-02 00:30:02 UTC
Permalink
Hello 9fans,

I have a question: what is the value of ARG_MAX of Plan9?

In Mac/OSX, the value is defined in /usr/include/sys/syslimits.h:
#define ARG_MAX (256 * 1024) /* max bytes for an exec function */

In APE, we can find the value in Plan9 source.
/sys/include/ape/sys/limits.h:
#define ARG_MAX 16384

However, I couldn't find ARG_MAX of Plan9.

Kenji Arisawa
Charles Forsyth
2012-05-02 00:54:16 UTC
Permalink
It's limited by the size of the temporary stack during exec, and
platform-specific.
The smallest seems to be 100 4k pages (less space for argv and Tos, I
suppose).
Newer variants of the system raise that to the size of the stack segment
(eg, 16 Mbytes),
which is still platform-specific. In fact, glancing at sysproc.c, I'm not
sure why it's limited
to TSTKSIZ given it goes on to allocate a much bigger segment to put them
in,
but even if that could easily be removed, currently that is the limit.
c***@gmx.de
2012-05-02 10:11:30 UTC
Permalink
as far as i can see, its just limited by this:
/*
* Build the stack segment, putting it in kernel virtual for the moment
*/
if(spage > TSTKSIZ)
error(Enovmem);

in pc/mem.h:55: #define TSTKSIZ 100 /* pages in new stack; limits exec args */

so that will give you arround half a megabyte for program
arguments.

--
cinap

Continue reading on narkive:
Loading...