[LUNI] rm helpKeith T. Garner kgarner at kgarner.comTue Jun 17 16:07:02 CDT 2003
On Tue, Jun 17, 2003 at 02:28:28, Steve Johnson said: > I've written a few cli apps and the two are definately handled > differently. You do have to specify arguments individually in your app, > or use a library to handle unlimited args for you. but I still think > there may be a limit for args, as for stdin, i think it's based on you > terminal programs limitations. The arg limit has nothing to do with your terminal program at all. It's actually a limitation defined by the kernel. Its defined in the include file <linux/limits.h> The line with this is: #define ARG_MAX 131072 /* # bytes of args + environ for exec() */ But that specifies in bytes how big that arg structure can be in bytges as well as the space for the environment. (I forgot to mention a third thing is passed to each C main, and thats an array of strings that has all your environmental variables.) On my friends OpenBSD box, there is a define named _POSIX_ARG_MAX which says you can have 4096 arguments. However, OpenBSD tops out at much more, as does Linux. Ah, found another reference in linux/binfmts.h /* * MAX_ARG_PAGES defines the number of pages allocated for arguments * and envelope for the new program. 32 should suffice, this gives * a maximum env+arg of 128kB w/4KB pages! */ #define MAX_ARG_PAGES 32 So, basically, there isn't a hard number, but there is a upper bounds in memory. Keith -- Keith T. Garner kgarner at kgarner.com The whole problem with the world is that fools and fanatics are always so certain of themselves, and wiser people so full of doubts. --Bertrand Russell
More information about the luni mailing list |