How much data can be passed as command line arguments?
-
18-09-2019 - |
Question
How many bytes can be sent as command-line argument when spawning a process under Linux?
Solution
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>
OTHER TIPS
Good article describes the issue:
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);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow