
mmap( fileno, length[, flags[, prot[, access]]]) (Unix version) Maps length bytes from the file specified by the file descriptor fileno, and returns a mmap object. If length is 0, the maximum length of the map will be the current size of the file when mmap() is called. flags specifies the nature of the mapping. MAP_PRIVATE creates a private copy-on-write mapping, so changes to the contents of the mmap object will be private to this process, and MAP_SHARED creates a mapping that's shared with all other processes mapping the same areas of the file. The default value is MAP_SHARED. Apparantly, this is wrong - the default is not MAP_SHARED, as I just found out the hard way.

Sorry, my mistake. Acutally, I was trying to debug this: 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', but this c++ code works: #include <sys/mman.h> #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> #include <iostream> int main() { int fd = open ("/dev/eos", O_RDWR); void* m = mmap (NULL, 1000000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); std::cout << m << '\n'; }

On Fri, Apr 25, 2008, Neal Becker wrote:
Sorry, my mistake. Acutally, I was trying to debug this:
python-dev is probably not the right place for this -- please use c.l.py or the list capi-sig. -- Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/ Why is this newsgroup different from all other newsgroups?

Sorry, my mistake. Acutally, I was trying to debug this: 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', but this c++ code works: #include <sys/mman.h> #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> #include <iostream> int main() { int fd = open ("/dev/eos", O_RDWR); void* m = mmap (NULL, 1000000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); std::cout << m << '\n'; }

On Fri, Apr 25, 2008, Neal Becker wrote:
Sorry, my mistake. Acutally, I was trying to debug this:
python-dev is probably not the right place for this -- please use c.l.py or the list capi-sig. -- Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/ Why is this newsgroup different from all other newsgroups?
participants (2)
-
Aahz
-
Neal Becker