[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: detecting mmap?
From: |
Bruce Korb |
Subject: |
Re: detecting mmap? |
Date: |
Fri, 19 Jul 2002 10:05:04 -0700 |
Donn Terry wrote:
> (You do make a good point, however. Maybe we need to consider adding a
> "MAP_ALL" flag
> to mmap() that says "validly map size, even if it's bigger than the
> object" (and zero fill)).
> That could be prototyped now, and proposed for the next POSIX if it
> works out to be useful.
> (Yeah, I know, it doesn't solve the immediate problem, but in the long
> run....))
That is a fix POSIX should make to mmap spec so it can do the
oversize mapping. If you try to mmap a PAGESIZE file into
a 2*PAGESIZE chunk of memory, the second page won't be mapped.
strlen() still faults. It's the spec. It's dumb. It's too early
for a "MAP_ALL". Anyway, back to the real argument: it is pretty
clear that either multiple tests are required, or you have to
parameterize the features and either select what you want or
have a feature test that emits multiple results:
#define MMAP_CAN_MAP_HEAP
#define MMAP_CAN_MAP_FIXED
#define HAVE_MMAP /* to some minimal degree */
... etc