tags:

views:

109

answers:

3

How many bytes can be sent as command-line argument when spawning a process under Linux?

+6  A: 

Good article describes the issue:

http://www.in-ulm.de/~mascheck/various/argmax/

gahooa
excellent article! Thanks!
jldupont
+4  A: 

This snippet will tell you.

#include <stdio.h>
#include <unistd.h>

int main(int argc, char** argv)
{
    const long value = sysconf(_SC_ARG_MAX);
    printf("ARG_MAX: %ld\n", value);
}
nall
+2  A: 

gahooa suggests a good article at http://www.in-ulm.de/~mascheck/various/argmax/, but if that page disappears someday, here's the meat of the matter: to find the max length of your command line arguments try one of the following

* command: getconf ARG_MAX
* system call: sysconf(_SC_ARG_MAX)
* system header: ARG_MAX in e.g. <[sys/]limits.h>
Shannon Nelson
This is a great summary!
gahooa