One of the issues that showed up during the overlong TIOBE- thread and
spinoffs is that there's no portable way to get a named shared memory
segment (as distinguished from a disk-backed file) using the mmap
module. Most unix variants provide a memory-backed file system that
works for this, but it's name changes from distro to distro and even
installation to installation. It's not clear to me that non-Unix
platforms provide such a file system.
The Posix solution is shm_open, which accepts a name for rendezvous
and returns a file descriptor suitable for passing to mmap. Passing
the file descriptor to anything but fstat, ftruncate, close and mmap
is undefined.
We'd also need to add shm_unlink to remove the shared segment, as the
object created by shm_open isn't necessarily visible in the file
system name space. shm_open has five values that can be used in it's
flags argument, but those are shared with open and already available
in the os module.
This seems like a slam-dunk to me, but...
1) Is there some reason not to just add these two functions?
2) Are there any supported platforms with mmap and without
shm_open/unlink?
3) Is this simple enough that a PEP isn't needed, just a patch in an
issue?
Thanks,
participants (7)
-
Antoine Pitrou
-
Christopher Reay
-
Greg Ewing
-
Mike Meyer
-
Nick Coghlan
-
shibturn
-
Sturla Molden