autoconf
[Top][All Lists]
Advanced

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

detecting mmap?


From: Donn Terry
Subject: detecting mmap?
Date: Wed, 17 Jul 2002 10:01:54 -0700

The current code to detect if mmap() is present and operational is
excessively draconian, in my opinion.

Specifically, it tests that a chunk of heap (in the middle) can be
unmapped and remapped as
mmap() space.  If an application uses that feature, it seems reasonable
to test for it, but many applications never use MAP_FIXED at all, or use
it in some way derived from a use where MAP_FIXED is not used.  The
POSIX standard allows an implementation to return EINVAL (this from the
2002 standard) in this sort of case:
   EINVAL  The addr argument (if MAP_FIXED was specified) or off is not
a multiple of
           the page size as returned by sysdonf(), or are considered
invalid by the
           implementation.

It's perfectly reasonable for the implementation to consider an address
in the
(ordinary) heap as invalid (just as much as it might consider code or
data invalid).

Including a test for a (probably) rarely used feature of mmap() as part
of the test for whether it is supported at all seems excessive.  (If the
application does use that sort of MAP_FIXED, it would be reasonable to
test for that explicitly.)  (Arguably that behavior could be considered
a misfeature, but let's not go there.)

I recognize that there are some backwards compatability issues here (in
that applications will need to determine how much of mmap() they really
need), but it seems (at least to me) to be a reasonable request.

Donn



reply via email to

[Prev in Thread] Current Thread [Next in Thread]