Hi, I am trying to setup a scenario where the parent starts a child PD in the C code, i.e., there is no <start> node for the child in the config file. It is similar to the rm_nested test example [1].
But in my scenario, I would like to start a server in the child and have the parent make RPC calls to it, and I need some help setting that up. I think the answer should be in some configuration of the ChildPolicy used to start the child, but I am missing something.
My code is here [2,3] and is a hybrid of the hello_tutorial and the rm_nested test case. Like rm_nested, the parent starts a child with the same binary and uses the failure to reach the RM service to indicate that it is in the child. But then, in my scenario, I start a HelloServer in the child, and the parent tries to establish a connection to this service.
I am seeing two errors: 1. An error that Genode complains that it wasn't expecting the child to announce a service. I tried fixing that by defining announce_service() in the Test_Child before starting the child, but that didn't fix it. TBH, I am wondering what to add to that function. 2. The parent cannot find the "Hello" service to connect to. I think that fixing (1) would fix two as well.
Any help pointing me in the right direction would be very helpful. Thanks as always!
Best, Sid sid-agrawal.ca
[1] https://github.com/genodelabs/genode/blob/master/repos/base/src/test/rm_nest... [2] https://github.com/sid-agrawal/genode/blob/76af718937e9723ae6cf2212a4ae549ef... [3] https://github.com/sid-agrawal/genode/blob/76af718937e9723ae6cf2212a4ae549ef...
Hi Sid,
On 2023-06-27 22:39, Sid Agrawal wrote:
I am trying to setup a scenario where the parent starts a child PD in the C code, i.e., there is no <start> node for the child in the config file. It is similar to the rm_nested test example [1].
But in my scenario, I would like to start a server in the child and have the parent make RPC calls to it, and I need some help setting that up. I think the answer should be in some configuration of the ChildPolicy used to start the child, but I am missing something.
we explored this idea in the past [1] but ultimately disregarded it [2].
[1] https://genode.org/documentation/release-notes/12.02#API_support_for_enslavi... [2] https://github.com/genodelabs/genode/issues/3754
You can still find a trace of it left as part of the qt_avplay component in the genode-world repository [3]. There you can find the slave.h header that implements the mechanism for hosting a service as a child.
[3] https://github.com/genodelabs/genode-world/tree/master/src/app/qt_avplay
For hosting and managing child components, I warmly recommend the use of the sandbox library [4], which is far more flexible while easier to use than the raw child.h interfaces. We plan to replace all manual uses of child.h by the use of the sandbox library eventually.
[4] https://genode.org/documentation/release-notes/20.02#New_sandbox_library_bas...
Any help pointing me in the right direction would be very helpful. Thanks as always!
As a general advice, please try to avoid making a parent depend on a child. It is better to either use an session interface that can be provided by the parent and invoked by the child, or to use a second child to interact with a child service. The latter approach is extensively used by the depot_download_manager, which orchestrates the downloading, verification, extraction, and installation of software in Sculpt OS.
Cheers Norman
Thanks for the explanation and links!
I am going to try the way described in [1,3] first as a way to unblock me, and then proceed to do it the Genode way described in the end.
Best, Sid
On Wed, Jun 28, 2023 at 2:17 AM Norman Feske norman.feske@genode-labs.com wrote:
[CAUTION: Non-UBC Email]
Hi Sid,
On 2023-06-27 22:39, Sid Agrawal wrote:
I am trying to setup a scenario where the parent starts a child PD in the C code, i.e., there is no <start> node for the child in the config file. It is similar to the rm_nested test example [1].
But in my scenario, I would like to start a server in the child and have the parent make RPC calls to it, and I need some help setting that up. I think the answer should be in some configuration of the ChildPolicy used to start the child, but I am missing something.
we explored this idea in the past [1] but ultimately disregarded it [2].
[1]
https://genode.org/documentation/release-notes/12.02#API_support_for_enslavi... [2] https://github.com/genodelabs/genode/issues/3754
You can still find a trace of it left as part of the qt_avplay component in the genode-world repository [3]. There you can find the slave.h header that implements the mechanism for hosting a service as a child.
[3] https://github.com/genodelabs/genode-world/tree/master/src/app/qt_avplay
For hosting and managing child components, I warmly recommend the use of the sandbox library [4], which is far more flexible while easier to use than the raw child.h interfaces. We plan to replace all manual uses of child.h by the use of the sandbox library eventually.
[4]
https://genode.org/documentation/release-notes/20.02#New_sandbox_library_bas...
Any help pointing me in the right direction would be very helpful. Thanks as always!
As a general advice, please try to avoid making a parent depend on a child. It is better to either use an session interface that can be provided by the parent and invoked by the child, or to use a second child to interact with a child service. The latter approach is extensively used by the depot_download_manager, which orchestrates the downloading, verification, extraction, and installation of software in Sculpt OS.
Cheers Norman
-- Dr.-Ing. Norman Feske Genode Labs
https://www.genode-labs.com · https://genode.org
Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth
Genode users mailing list users@lists.genode.org https://lists.genode.org/listinfo/users