Hello,
On Thu, 2013-12-12 at 17:57 +0100, Robert Kaiser wrote:
Hi Björn,
Thanks for your response.
Am 12.12.2013 09:56, schrieb Björn Döbel:
Hi Robert,
[..]
Capabilities are passed around through standard IPC. The difference is that you don't put them into the UTCB's message registers but instead you out a send flexpage into the UTCB buffer registers. Note, that the receiver must be willing to receive and therefore has to add a receive flexpage on its side beforehand.
> Can anyone point me to some helpful documentation or maybe > an example I could cannibalize to implement this > (preferably in C, but C++ code would surely be helpful > too)?
Unfortunately, there's no example that does exactly what you want. But you might want to look at the following two:
- l4/pkg/examples/libs/l4re/streammap demonstrates delegation
of resources (memory pages in this case) from a server to a client. Sending cap fpages is similar - you basically replace Rcv_fpage::mem() with Rcv_fpage::obj() etc.
- l4/pkg/examples/libs/l4re/c++/clntsrv_ns is an adaptation of
l4/pkg/examples/clntsrv that passes capabilities the other way round. The client creates an IPC gate, sends it to the server through an L4Re namespace, and the server then obtains this channel and binds a server-side thread to receive messages through this channel.
I *sort of* got this working, however there is a problem which I don't understand.
Would you mind sharing your example code? This would make it easier to understand what's going on.
I hope it is OK to send mails with attachments to the mailing list? If so, you'll find my source code attached. In file client_c.c, line 85/85, you'll find a commented-out ipc_receive() call followed by an ipc_wait() call.
I think the problem is the first parameter of ipc_receive. The parameter specifies the object from which you would like to receive a message.
You wrote that you would like to receive a message from the IPC gate, but IMO you have to specify the thread from which you would like to receive a message.
Have a look on the following examples examples/sys/utcb-ipc/main.c examples/sys/aliens/main.c
Best regards, Tobias