[okl4-developer] Shared memory between two services
Nelson Tam
nelson at ok-labs.com
Wed Feb 27 23:28:28 EST 2008
Hi,
On 26/02/2008, at 17:51, Nelson Tam wrote:
> Tomorrow I will talk about how to do this statically during
> configuration time.
As promised I will mention how to set up shared memory during
configuration time. If all you need is a single, static shared
memsection, then this is a somewhat easier way to go.
First you need to build as normal. When the build succeeds, you will
find an XML file at build/images/weaver.xml.
You can then specify that you want to create a memsection in one
program (which is in effect a PD), and share that with another program.
In the program that you want to create the memsection in, insert the
following in the corresponding <program> tag:
<program name="server" ... >
<memsection name="shared" size="0x1000" attach="rwx" />
</program>
Then in the program(s) that you want to share this memsection with,
insert the following:
<program ... >
<environment>
<entry key="SHARED" cap="../server/shared" attach="rwx" />
</environment>
</program>
The program name of the memsection "host" (ie. the first program)
should be part of the cap path within the memsection "guest" (the
second program), as in the example.
Now during runtime, programs with the memsection cap can do the
following:
memsection_ref_t ms = env_memsection(iguana_getenv("SHARED"));
to retrieve the memsection that is identified by the key "SHARED".
Nelson.
More information about the Developer
mailing list