environment arg_max

environment arg_max

Post by michael.jon » Fri, 24 Feb 1995 08:41:42



In NCR SVR4 the kernel can be reconfigured to increase the environment
max line length (default is ARG_MAX=5120). In Solaris 2.3 the default appears
to be 1024 in use.  What parameter should be set in /etc/system to yield a
similar effect?

Thanks

---------------------------------------------------

AT&T - GCIS - WINGS  System Administrator

 
 
 

environment arg_max

Post by Casper H.S. D » Fri, 24 Feb 1995 19:54:11



>In NCR SVR4 the kernel can be reconfigured to increase the environment
>max line length (default is ARG_MAX=5120). In Solaris 2.3 the default appears
>to be 1024 in use.  What parameter should be set in /etc/system to yield a
>similar effect?

The default limit is 1 megabyte in Solaris 2.x.

I don't think you can change it.

Casper

 
 
 

1. size of argument list can be larger than ARG_MAX?

As I understand
The size of environment variable and the size of argument list, i.e.
strlen(envp[0]) + strlen(envp[1]) + .. + strlen(argv[0]) + strlen(argv[1]) + ..
can not be larger than ARG_MAX, which is 1048320 on Solaris.

By using env -i, none of environment variables are used, so
the size of argument list can not be larger than ARG_MAX,
which is 1048320 on Solaris.

However the following example can be compiled and run with
env -i ./a.out
And this shows that the size of argument list can be
1048355+6=1048461. What is the matter?

I run different tests, and all show that the size of argument list can be
larger than ARG_MAX, but how much larger is different.

Please help me to understand this issue, thanks.

#include <stdlib.h>
#include <string.h>

#ifndef _ARG_MAX
#define _ARG_MAX 1048355
#endif

int
main(int argc, char **argv, char **envp)
{
    char *arg = malloc((size_t) _ARG_MAX);
    memset(arg, ' ', _ARG_MAX);

    execlp("/bin/ls", arg, '\0');
    perror("exec");

2. NIS problem

3. Increasing ARG_MAX

4. solaris 2.6 kernel patch fails..

5. ARG_MAX

6. dumping NIS+

7. The ARG_MAX kernel value

8. Ramen hits NASA

9. max size of arguments can be >, =, < ARG_MAX, a bug?

10. Q: xargs & LINE_MAX/ARG_MAX

11. Change the value of ARG_MAX

12. Why does the cgi environment not inherit environment variables?

13. how to export shell environment variables to the primary environment?