Skip to contentSkip to conversation

Posix vs Alchemy - multiplexing and registry

Xenomai Julien Blanc 2 participants 4 messages Jan 25, 2018

lore
Share & tools
lore
#0 lore raw

Hi,

We have a xenomai 3 application currently using the alchemy API (application development started on xenomai 2.x).

We would like to add I/O multiplexing in some parts of the application. My understanding is that it is not supported by the alchemy API, so we would have to resort to the Posix API.

The downside is that by doing so, we lose the registry : with the posix api nothing is exported. We would like to access all this data, at least for debugging purposes (ideally, disable it in production build).

I couldnt find any pointer for doing either of the following :
- enable the registry while using the posix API
- multiplex using the alchemy api
- retrieve a posix-api compatible file descriptor from an alchemy handle (which would allow a __cobalt_select call)

Is there some resources or something obvious that i'm missing ?

Best regards,

Julien

#1 lore raw
Quoted 13 lines · Julien Blanc

Hi,

We have a xenomai 3 application currently using the alchemy API (application development started on xenomai 2.x).

We would like to add I/O multiplexing in some parts of the application. My understanding is that it is not supported by the alchemy API, so we would have to resort to the Posix API.

The downside is that by doing so, we lose the registry : with the posix api nothing is exported. We would like to access all this data, at least for debugging purposes (ideally, disable it in production build).

Quoted 8 lines

I couldnt find any pointer for doing either of the following :
- enable the registry while using the posix API
- multiplex using the alchemy api
- retrieve a posix-api compatible file descriptor from an alchemy handle (which would allow a __cobalt_select call)

Is there some resources or something obvious that i'm missing ?

There is no provision for I/O multiplexing with alchemy. Only the pipe object embeds a RTDM file descriptor which could be passed to libcobalt's select() implementation, other resources (e.g. queues, buffers etc) don't.

I would suggest to enable the registry for your application (not for the entire POSIX API), as you might not need each and every resource to be exposed via a fuse-based fs.

To do so, you can link against libcopperplate, which is not documented. However, looking at lib/alchemy/init.c may give you some hints about the way to create your own registry hierarchy (see alchemy_init()). Then looking at sections defined for CONFIG_XENO_REGISTRY in e.g. queue.c would give you an illustration of a proper client-side usage, for populating this hierarchy with object nodes, and the way to return information back when those nodes are opened for reading.

Signature · 1 line
Philippe.
#2 lore raw

Le jeudi 25 janvier 2018 à 15:21 +0100, Philippe Gerum a écrit :

Quoted 6 lines · Julien Blanc
Quoted 1 line

There is no provision for I/O multiplexing with alchemy. Only the pipe object embeds a RTDM file descriptor which could be passed to libcobalt's select() implementation, other resources (e.g. queues, buffers etc) don't.

Thanks for your answer. If i understand correctly, this also means that it is not recommended to mix both APIs in the same program. For example a queue created with rt_create_queue cannot be read with __cobalt_mq_open, am I right ?

Quoted 3 lines

I would suggest to enable the registry for your application (not for the entire POSIX API), as you might not need each and every resource to be exposed via a fuse-based fs.

This is something i'd rather avoid if possible. Though, thanks for the pointers, at first glance it seems much simpler than what i feared.

Regards,

Julien

#3 lore raw
Quoted 8 lines · Julien Blanc

Le jeudi 25 janvier 2018 à 15:21 +0100, Philippe Gerum a écrit :

Quoted 6 lines · Julien Blanc
Quoted 1 line

There is no provision for I/O multiplexing with alchemy. Only the pipe object embeds a RTDM file descriptor which could be passed to libcobalt's select() implementation, other resources (e.g. queues, buffers etc) don't.

Quoted 4 lines

Thanks for your answer. If i understand correctly, this also means that it is not recommended to mix both APIs in the same program. For example a queue created with rt_create_queue cannot be read with __cobalt_mq_open, am I right ?

Correct. One may use both POSIX and alchemy APIs in the same program though, but calls referring to equivalent objects (e.g. sem, queue, task/threads, etc) are not interchangeable. alchemy provides high-level services built on basic POSIX calls.

Quoted 8 lines
Quoted 4 lines

I would suggest to enable the registry for your application (not for the entire POSIX API), as you might not need each and every resource to be exposed via a fuse-based fs.

This is something i'd rather avoid if possible. Though, thanks for the pointers, at first glance it seems much simpler than what i feared.

It is pretty simple, just not documented.

Signature · 1 line
Philippe.