In article <firstname.lastname@example.org>,
Alan Cox <email@example.com> wrote:
>On Fri, 2002-05-31 at 14:00, Thomas 'Dent' Mirlacher wrote:
>> and the checks in various places are really strange. - well some
>> places check for:
>> o != NULL
>> o > -1024UL
>"Not an error". Its relying as some other bits of code do actually that
>the top mappable user address is never in the top 1K of the address
>> is it possible to have 0 as a valid address? - if not, this should
>> be the return on errors.
>SuS explicitly says that 0 is not a valid mmap return address.
But if so, SuS is _very_ _very_ wrong.
The fact is, if you use something like vm86 mode, you absolutely _need_
to be able to explicitly mmap at address 0.
So it is correct (and in fact there is no other sane way to do it) to
addr = mmap(NULL, 1024*1024,
PROT_READ | PROT_WRITE ,
MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED,
and if SuS says that mmap must not return NULL for this case, then SuS
is so full of sh*t that it's not worth worrying about.
In short, under Linux 0 _is_, and will always be (at least on x86) a
perfectly valid return address from mmap() and friends. It's only going
to be returned when you explicitly ask for it with MAP_FIXED, but it
absolutely is a valid return.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to firstname.lastname@example.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Fri May 31 2002 - 22:00:31 EST