[Python-Dev] mmapmodule.c,2.10,2.11

Vladimir Marangozov Vladimir.Marangozov@inrialpes.fr
Tue, 20 Jun 2000 03:11:24 +0200 (CEST)


Andrew Kuchling wrote:
> 
> On Sun, Jun 18, 2000 at 02:50:51AM +0200, Vladimir Marangozov wrote:
> >On AIX, the test_mmap fails with errno=EINVAL on the m.flush() method.
> >It works okay without the MS_INVALIDATE flag though, so I'd suggest
> >removing it from msync in the flush and dealloc methods.
> 
> Ooh, you're right.  The Linux msync man page says "MS_ASYNC specifies
> that an update be scheduled, but the call returns immediately.
> MS_SYNC asks for an update and waits for it to complete.
> MS_INVALIDATE asks to invalidate other mappings of the same file (so
> that they can be updated with the fresh values just written)."  So
> MS_INVALIDATE seems far too drastic.

Yes.

> 
> >Also, it would probably be a good idea to allow optional flags for
> >flush, as it's done in new_mmap_object, the default being only MS_SYNC.
> 
> The problem is: does Windows provide equivalent functionality?  (Is
> there documentation available online for CreateFileMapping that I
> could look at?)

Well, I had a look at my Windows book. Although the mmap functionnality is
equivalent, overall, there are no equivalent flags in FlushViewOfFile, etc.
Maybe this is too subtle to be of any real use after all, so I retract the
idea. MS_SYNC alone is fine.

Another point: I'm not thrilled about the idea of raising a SystemError
for m.resize if native mremap is missing (which is also AIX's case).
unmap/mmap again with the new size is the emulation solution everybody
would do in Python when m.resize is not implemented. So I'd suggest
implementing it in C (which is what the Windows version does, btw).
Furthermore, having an unimplemented method makes little sense to me.
For implementing this emulation on Unix, however, we would need to
remember in additional slots the original mmap flags & rights, so that
the second (or any subsequent) mmap call uses the same flags & rights
as the first one.

-- 
       Vladimir MARANGOZOV          | Vladimir.Marangozov@inrialpes.fr
http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252