And here are some results from various machines I happen to have access to:# Print out the system's architecture uname -rms # or uname -a # Let the C preprocessor read in the system's limits from limits.h # and then expand the macro ARG_MAX # Filter out excess output (there will be some line number information # and a gadzillion empty lines) # # On some gcc systems, I have been unable to find a working cpp. # You can use gcc -E - <:<:HERE | tail -1 in that case. cpp <<HERE | tail -1 # Only the last line is interesting #include <limits.h> ARG_MAX HERE
Linux 2.0.33 i686 131072
SunOS 5.4 sun4m 1048320
SunOS 4.1.3 sun4c ARG_MAX
Curiously, SunOS 4 knows about _POSIX_ARG_MAX, which is correctly set to 4096.
According to Stevens, SunOS 4.1.1 allows a megabyte of information to be passed (1048576 bytes).
OSF1 V4.0 alpha 38912
IRIX 5.3 IP12 ARG_MAX
There is something funny about how IRIX does these things but I found the value 5120 in an #ifndef in limits.h
NetBSD 1.2C mac68k (256 * 1024)
(For the lazy people without dc
(1) handy,
that's 262144 bytes.)
or evenls * */*
and of coursels *
On any system, the last of the examples is going to blow up sooner or later. This is why we havefor f in `find . -print`; do : something done
xargs
:
This is of course still not a secure construction (depending of course on what the : something attempts to do). But that's another story.find . -print | xargs : something