Re: Almost insignificant patch for mmapmodule
On Sat, Jun 17, 2000 at 04:29:14PM +0200, Lorenzo M. Catucci wrote:
therefore, here is the change: if we are compiling for linux, define _GNU_SOURCE before including mman.h, and all is done. It seems the
Hmm... IMHO this points out a bug; if MREMAP_MAYMOVE is not present, that doesn't imply that mremap() doesn't work at all; instead, a resize may fail if the mapping would have to be moved to a different virtual address. Quoting from the Linux man page: MREMAP_MAYMOVE indicates if the operation should fail, or change the virtual address if the resize cannot be done at the current virtual address. I think the correct fix is to simply specify MREMAP_MAYMOVE if it's defined, but still support attempting to resize. Possibly the configure script should also check for mremap()'s existence. --amk
On Sun, 18 Jun 2000, Andrew Kuchling wrote: AK> On Sat, Jun 17, 2000 at 04:29:14PM +0200, Lorenzo M. Catucci wrote: AK> >therefore, here is the change: if we are compiling for linux, define AK> >_GNU_SOURCE before including mman.h, and all is done. It seems the AK> AK> Hmm... IMHO this points out a bug; if MREMAP_MAYMOVE is not present, AK> that doesn't imply that mremap() doesn't work at all; instead, a AK> resize may fail if the mapping would have to be moved to a different AK> virtual address. Quoting from the Linux man page: AK> AK> MREMAP_MAYMOVE AK> indicates if the operation should fail, or change AK> the virtual address if the resize cannot be done at AK> the current virtual address. AK> AK> I think the correct fix is to simply specify MREMAP_MAYMOVE if it's AK> defined, but still support attempting to resize. Possibly the AK> configure script should also check for mremap()'s existence. AK> I think I've been too dense... Here I see two problems: on one hand, from what I have understood of python's object, it's much better if the c pointers are movable in VM on the remap, and the MAYMOVE flag is only defined in mman.h if _GNU_SOURCE is; on the other hand, we only know about linux mremap semantics: for what I see in linix mremap(2) """ CONFORMING TO This call is Linux-specific, and should not be used in programs intended to be portable. 4.2BSD had a (never actually implemented) mremap(2) call with completely dif ferent semantics. """ Therefore, I think that really checking for __linux__ and using the MAYMOVE flag, which is thefined there, is going towards the right way. If someone else comes out with another kernel supporting a mremap syscall[1], I think we'll be able to add proper support afterwards. As for the configure script, on linux we have both mremap and MAYMOVE; if you go to the <a href="http://www.gnu.org/software/libc/all-M.html">Extended UNIX ABI, M* </a> Page, you'll find: GNU Unix98 Unix95 POSIX ISO C SVID 3 4.3BSD XPG mremap X It seems only the systems supported by GNU libc-2 (only linux systems, then) support mremap... Have a nice time. lmc * Just tried searching for mremap on http://www.FreeBSD.org/cgi/man.cgi?query=mmap and looked around the various BSD derivatives whose man pages are available there. +-------------------------+----------------------------------------------+ | Lorenzo M. Catucci | Centro di Calcolo e Documentazione | | catucci@ccd.uniroma2.it | Università degli Studi di Roma "Tor Vergata" | | | Via O. Raimondo 18 ** I-00173 ROMA ** ITALY | | Tel. +39 06 7259 2255 | Fax. +39 06 7259 2125 | +-------------------------+----------------------------------------------+
participants (2)
-
Andrew Kuchling
-
Lorenzo M. Catucci