Provide session from libc code

Christian Helmuth christian.helmuth at ...1...
Mon Oct 16 15:33:19 CEST 2017

Hello Johannes,

On Mon, Oct 16, 2017 at 01:42:04PM +0200, Johannes Kliemann wrote:
> I tried to create a provide an input session from a libc (in this case
> an Qt application). If I just run it from the Main struct it will
> correctly announce the session but since Main never returns, no client
> will be able to use it.
> I tried to circumvent this by putting the application into a separate
> thread but this led to the following error:
> > Error: void Libc::Kernel::run(Libc::Application_code&) called from non-kernel context
> Running this Qt application without wrapping it into with_libc makes it
> segfault on initialization.
> What is the correct way to do this? My current main is at [1].

Unfortunately, there is no "correct" way of implementing tasks like
the described currently. I must admit that with_libc() is the most
confusing function in Genode currently and we therefore will remove it
from the API soon. In fact, I myself did not expect that with_libc()
is needed in your context but there may be dependencies unknown to me.

I'd suggest a careful look into libports/src/app/avplay which provides
an input session too. The approach there is to create a second Genode
entrypoint for the input service and execute Qt code in the component
thread. I strongly encourage you not just to copy the avplay code as
it uses the older, low-level Rpc_entrypoint but use

Christian Helmuth
Genode Labs · · /ˈdʒiː.nəʊd/

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth

More information about the users mailing list