problem with mmap

hdante hdante at gmail.com
Sat Apr 26 05:04:32 CEST 2008


On Apr 25, 4:43 pm, Carl Banks <pavlovevide... at gmail.com> wrote:
> On Apr 25, 9:37 am, Neal Becker <ndbeck... at gmail.com> wrote:
>
> > On linux, I don't understand why:
>
> > f = open ('/dev/eos', 'rw')
> > m = mmap.mmap(f.fileno(), 1000000, prot=mmap.PROT_READ|mmap.PROT_WRITE,
> > flags=mmap.MAP_SHARED)
>
> > gives 'permission denied',
>
> Try
>
> f = open('/dev/eos', 'r+')
>
> Carl Banks

 The equivalent code in python should be:

 import os, mmap
 f = os.open('/dev/eos', os.O_RDWR)
 m = mmap.mmap(f, 1000000, prot=mmap.PROT_READ|mmap.PROT_WRITE,
               flags=mmap.MAP_SHARED)

 That should work like the C++ code.



More information about the Python-list mailing list