Shared memory and IPC
Branko Čibej
brane at xbc.nu
Mon Sep 10 11:42:06 GMT 2001
Luke Kenneth Casson Leighton wrote:
>the implementation has, if you to are pass over data
>structures between programs, presumably in exactly
>the same way that those DB apps are doing,
>
I don't think DBMSs pass around pointers.
> you must
>preserve pointers / memory segment offsets.
>
>and that means using MMAP_FIXED.
>
>if anyone has any better ideas, love to hear them.
>
You're passing around structured defined in IDL, right? Therefore you
know exactly where the pointers are. I assume pointers are the only bits
that will cause problems if the segment isn't mapped to the same
addresses in both apps.
If all of the above is correct, and MMAP_FIXED fails (as it sometimes
will) or isn't available (as it often isn't), you can simply fixup the
pointers by adding an offset -- the difference between the addresses of
the mapped area in the two apps. That would still be faster than a
memcpy (except if you're passing arrays of poitners).
--
Brane Čibej <brane at xbc.nu> http://www.xbc.nu/brane/
More information about the samba-technical
mailing list