"Richard L. Hamilton" <[EMAIL PROTECTED]> wrote: > > My questions are: > > > > - How do I get the 32 bit ARG_MAX value from inside a > > 64 bit program? > > Well, unless someone adds an _SC_ARG32_MAX and _SC_ARG64_MAX,
There is #define _ARG_MAX32 1048320 /* max length of args to exec 32-bit program */ #define _ARG_MAX64 2096640 /* max length of args to exec 64-bit program */ > I suppose you need to popen() a helper program of the bitness other > than your own that looks this up for you. You'd want to have a flag, > so you only did that the first time you needed to know, and cached > the value for subsequent use. This does not seem to be a good solution > > - What is the best way to detect whether "cmd" is a > > 32 os a 64 bit binary? > > I'm not sure that's generally answerable. If the executable is also readable, > you can do anything from run "file" on it to using the libelf functions (or > the > even more generic and portable GNU bfd library if available) to discover its > type, with a library call of course being much more efficient than calling an > external program. But an executable doesn't have to be readable, in which > case I suppose you have to make the safer assumption, in this case that it's > a 32-bit process. Well, there is gelf_getclass() > In general, I have a problem with people using insanely large argument lists; Then you seem to missunderstand the background. > a directory with hundreds of thousands of files probably won't perform well > anyway, and aside from wildcard expansions, there's really no excuse _at_all_, > for it IMO (and it's their responsibility to only use wildcards when their > expansions I am not sure if you ever did think about the problem. - Your keyword "wildcard" does not apply at all - Try to write a simple command that count the lines of code in ON > could safely be expected to be reasonable sized). That's what xargs, or a > program reading its stdin rather than taking args, is for. (And I remember > the xargs is the wrong solution for a problem - xargs does not deal with all possible filenames, "find . -exec bla {} +" does. > really old days when the max arg list size was something tiny, like 5120 or > so.) This is the limit from the 1970s. In the mid 1980s it was 20000 and since SunOS-4.0 it is 1 MB, so the 1 MB limit is 20 years old now. Jörg -- EMail:[EMAIL PROTECTED] (home) Jörg Schilling D-13353 Berlin [EMAIL PROTECTED] (uni) [EMAIL PROTECTED] (work) Blog: http://schily.blogspot.com/ URL: http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily _______________________________________________ opensolaris-code mailing list opensolaris-code@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/opensolaris-code