Shared memory and IPC
peter at cadcamlab.org
Thu Sep 6 14:26:05 GMT 2001
> And how do you tell if a range is mapped in your address space?
Hmmm, you could trap SIGSEGV and SIGBUS and then read from the address.
Or, try to mmap without MAP_FIXED and tell the peer process to try that
address ... repeat if fail ... and of course unmap the unused mappings
I was going to say just use brk() and keep track of your own mappings,
but some versions of malloc use mmap() to replace or augment sbrk().
(GNU libc does this.)
On Linux you can open /proc/self/maps and parse that. Not exactly the
most portable solution, of course!
More information about the samba-technical