Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

12
  • 2
    That ARG_MAX is the minimum guaranteed for the arg+env size limit, it's not the max size of a single argument (though it happens to be the same value as MAX_ARG_STRLEN) Commented Mar 20, 2014 at 20:48
  • Do you have a date for your eglibc-2.18/NEWS snippet? It would be good to pin this down to a particular kernel version. Commented Mar 20, 2014 at 21:06
  • @StephaneChazelas: I'm just too lazy to find the part, but if arg exceeds the max value it isn't necessary to figure out the env size. Commented Mar 20, 2014 at 21:06
  • 2
    You're looking at glibc code, that's irrelevant here. The libc doesn't care what size of arguments you're passing. The code you're quoting is about sysconf, an API to gives users an idea of the maximum size (whatever that means) of argv+env passed to an execve(2). It's the kernel that accepts or not the arg and env list passed along an execve() system call. The getconf ARG_MAX is about the cumulative size of arg+env (variable in recent Linux, see ulimit -s and the other question I linked), it's not about the max length of a single arg for which there's no sysconf/getconf query. Commented Mar 20, 2014 at 21:24
  • 1
    The maximum for a single argument is MAX_ARG_STRLEN. If your still not convinced, see the comments in binfmts.h. The ARG_MAX in limits.h is a hard lower bound to the maximum size of the argument/environment array. Normally this is a function of the stack size which may be changed - this is what you get with getconf ARG_MAX. Commented Mar 21, 2014 at 0:09