RT tasks can create/map standard Linux shared memory using either mmap(), or shm_open().?0?2 However, if you need dynamic memory management inside that shared memory, you'd have to add that, along with any required locking, so in that case you're better off using rt_heap_xxx() routines.

But, if all you need is a fixed-size memory block shared by multiple processes (like using H_SINGLE with rt_heap_create() would do), then these calls will do the job.?0?2 Normal Linux (non-Xenomai) processes can also map to these shared memory blocks using the same calls.

Steve


On 4/1/2021 10:02 AM, Peter Laurich via Xenomai wrote:
No other way that I am aware of. I was troubled by the --session and --mem-pool-size switches for a long time as well.

Peter

On 4/1/2021 10:44 AM, zy wrote:
Hi Peter,

You solved what has troubled me for a long time. Thank you for your reply.
I know the conception of session of linux for the first time.
In addition, I would like to know if there is other method ?

Best regards,
Zhou Yang

------------------?0?2?????????0?2------------------
*??????:* "Peter Laurich" <xenomai@xenomai.org>;
*????????:*?0?22021??4??1??(??????) ????8:43
*??????:*?0?2"xenomai"<xenomai@xenomai.org>;
*????:*?0?2Re: Shared Memory by using RT_HEAP

Hello,

I suspect that your problem may be the same as I had earlier. If you are
sharing heaps then you have more than one program that needs to have the
same Xenomai session. Here is how I spawn two programs that share the
same heap and other Xenomai objects:

?0?2?0?2?0?2 ./initSys?0?2 --session=akamina --mem-pool-size=20M &
?0?2?0?2?0?2 ./sacqScan --session=akamina --mem-pool-size=20M &

where initSys and sacqScan are two of my programs, I have chosen to name
the session akamina and I wanted a memory pool size of 20M (rather than
the default of 1M).

Good luck with your upgrade. I have found the upgrade from 2 to be
incredibly painful and I am now stuck a little further down the path
than you. I found that I lost functionality that I relied on (e.g.
exchanging events and messages between kernel drivers and user-space
programs) that is not easy to replace. I looked at staying with Xenomai
2 but I do need a more recent kernel so I am stuck.

Good luck.

Peter


On 3/31/2021 9:25 PM, zy via Xenomai wrote:
> Hi all,
>
> On Xenomai-2.6.5, I use rt_heap_create with flag "H_SHARED" to create rt_heap > in one process and call rt_heap_bind to get this rt_heap by the same name in another > process. I use rt_heap as shared memory between process. But on Xenomai-3.1, I > find this method does not work. When calling rt_heap_bind using "TM_INFINITE", > the function doesn't return, using "TM_NONEBLOCK", returns -11. I check this > email system , find "--enable-pshared" should be configured before installation?0?2 and
> I do it, but it doesn't work.
> Can anyone give me a detailed solution? Or, shared memory cannot be created by
> RT_HEAP on Xenomai-3.
>
> Best regards,
> Zhou Yang

Reply via email to