[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] Commandline handling in the kernel



On Thu, 2009-01-15 at 22:35 +0100, Miro Kropacek wrote:
> 
>         Right, but what I'm saying is if you do a sysconf(_SC_ARG_MAX)
>         you get
>         128 (or 127 can't remember off hand) which is wrong - isn't
>         it ?
> Why do you think ARGV and ARG_MAX have to be related to each other?
> I'd say ARG_MAX says something about the length for "normal" arguments
> while ARGV is something completely different. Look into mintlib's
> startup code, from what I remember it certainly doesn't append stuff
> from ARGV env variable into regular command line buffer -- it's
> handled differently, what is right thing in my opinion. So normal ARG
> buffer (command line) = 128 max, ARGV buffer = unlimited and handled
> differently.

O.k. I understand the point. "man execve" under the paragraph 
"Limits on size of arguments and environment" suggests they are linked,
but in this case (and others) they're not.

So onto some more detail....

In include/bits/posix1_lim.h we define _POSIX_ARG_MAX to be 4096, and in
include/bits/local_lim.h ARG_MAX is 32767. Yet when we do
sysconf(_SC_ARG_MAX) it's 126 (just checked).

A few programs actually use sysconf(_SC_ARG_MAX) as the method to check
and this kernel imposed limit is far too small for some applications.
Yet if they used used _POSIX_ARG_MAX or ARG_MAX they'd get a better
answer.

So I'm trying to understand why the kernel is answering with such a low
value, and I'm sure in this case it should be higher than 126.

Look at freemint/sys/dos.c at line 579. 

Shouldn't this indeed be higher ??

Alan.