All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] shared memory segments
@ 2012-07-09 10:26 Jorge Ramirez Ortiz,  HCL Europe
  2012-07-09 12:38 ` Gilles Chanteperdrix
  2012-07-09 17:46 ` Gilles Chanteperdrix
  0 siblings, 2 replies; 7+ messages in thread
From: Jorge Ramirez Ortiz,  HCL Europe @ 2012-07-09 10:26 UTC (permalink / raw)
  To: xenomai

Hi all,
I am doing a port of a  shared library; in this library , a shared memory segment is being mapped (now using the Xenomai POSIX skin.)
Some semaphores and data are placed on that shared segment.

Is there a way to mark the shared memory segment for deletion (unlink) after the last process detaches it (basically what shmctl(shmid, IPC_RMID, &shmInfo) does)
cheers
Jorge


::DISCLAIMER::
----------------------------------------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents
(with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates.
Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the
views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and / or publication of this message without the prior written consent of authorized representative of
HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately.
Before opening any email and/or attachments, please check them for viruses and other defects.

----------------------------------------------------------------------------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Xenomai] shared memory segments
  2012-07-09 10:26 [Xenomai] shared memory segments Jorge Ramirez Ortiz,  HCL Europe
@ 2012-07-09 12:38 ` Gilles Chanteperdrix
  2012-07-09 17:46 ` Gilles Chanteperdrix
  1 sibling, 0 replies; 7+ messages in thread
From: Gilles Chanteperdrix @ 2012-07-09 12:38 UTC (permalink / raw)
  To: Jorge Ramirez Ortiz, HCL Europe; +Cc: xenomai

On 07/09/2012 12:26 PM, Jorge Ramirez Ortiz, HCL Europe wrote:
> Hi all, I am doing a port of a  shared library; in this library , a
> shared memory segment is being mapped (now using the Xenomai POSIX
> skin.) Some semaphores and data are placed on that shared segment.
> 
> Is there a way to mark the shared memory segment for deletion
> (unlink) after the last process detaches it (basically what
> shmctl(shmid, IPC_RMID, &shmInfo) does) cheers Jorge

No, but you can "shm_unlink" it when the last process has attached, this
will make it inaccessible to new processes, but still usable by
processes already attached. And the shared memory segment will be
destroyed when the last process detaches.

-- 
					    Gilles.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Xenomai] shared memory segments
  2012-07-09 10:26 [Xenomai] shared memory segments Jorge Ramirez Ortiz,  HCL Europe
  2012-07-09 12:38 ` Gilles Chanteperdrix
@ 2012-07-09 17:46 ` Gilles Chanteperdrix
  2012-07-09 17:55   ` Jorge Ramirez Ortiz,  HCL Europe
  1 sibling, 1 reply; 7+ messages in thread
From: Gilles Chanteperdrix @ 2012-07-09 17:46 UTC (permalink / raw)
  To: Jorge Ramirez Ortiz, HCL Europe; +Cc: xenomai

On 07/09/2012 12:26 PM, Jorge Ramirez Ortiz, HCL Europe wrote:
> Hi all, I am doing a port of a  shared library; in this library , a
> shared memory segment is being mapped (now using the Xenomai POSIX
> skin.) Some semaphores and data are placed on that shared segment.
> 
> Is there a way to mark the shared memory segment for deletion
> (unlink) after the last process detaches it (basically what
> shmctl(shmid, IPC_RMID, &shmInfo) does) cheers Jorge

Just so we are clear: the only thing xenomai posix skin shared memory
are useful for is sharing memory between kernel-space and user-space.
So, if your intent is to simply share memory between two xenomai
user-space applications, you can use plain linux shared memory,
including system 5 shared memory if you prefer.

-- 
                                                                Gilles.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Xenomai] shared memory segments
  2012-07-09 17:46 ` Gilles Chanteperdrix
@ 2012-07-09 17:55   ` Jorge Ramirez Ortiz,  HCL Europe
  2012-07-09 18:02     ` Gilles Chanteperdrix
  0 siblings, 1 reply; 7+ messages in thread
From: Jorge Ramirez Ortiz,  HCL Europe @ 2012-07-09 17:55 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

hi Gilles
Not sure I understand now.
Let's say that I also need to place a mutex on that shared region to be shared between other Xenomai applications. 
The mutex would obviusly be wrapped by the posix skin but not the system5 shared request.
Would that work??
thanks for all the help
Jorge
________________________________________
From: Gilles Chanteperdrix [gilles.chanteperdrix@xenomai.org]
Sent: 09 July 2012 18:46
To: Jorge Ramirez Ortiz,  HCL Europe
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] shared memory segments

On 07/09/2012 12:26 PM, Jorge Ramirez Ortiz, HCL Europe wrote:
> Hi all, I am doing a port of a  shared library; in this library , a
> shared memory segment is being mapped (now using the Xenomai POSIX
> skin.) Some semaphores and data are placed on that shared segment.
>
> Is there a way to mark the shared memory segment for deletion
> (unlink) after the last process detaches it (basically what
> shmctl(shmid, IPC_RMID, &shmInfo) does) cheers Jorge

Just so we are clear: the only thing xenomai posix skin shared memory
are useful for is sharing memory between kernel-space and user-space.
So, if your intent is to simply share memory between two xenomai
user-space applications, you can use plain linux shared memory,
including system 5 shared memory if you prefer.

--
                                                                Gilles.


::DISCLAIMER::
----------------------------------------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents
(with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates.
Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the
views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and / or publication of this message without the prior written consent of authorized representative of
HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately.
Before opening any email and/or attachments, please check them for viruses and other defects.

----------------------------------------------------------------------------------------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Xenomai] shared memory segments
  2012-07-09 17:55   ` Jorge Ramirez Ortiz,  HCL Europe
@ 2012-07-09 18:02     ` Gilles Chanteperdrix
  2012-07-09 18:19       ` Jorge Ramirez Ortiz,  HCL Europe
  0 siblings, 1 reply; 7+ messages in thread
From: Gilles Chanteperdrix @ 2012-07-09 18:02 UTC (permalink / raw)
  To: Jorge Ramirez Ortiz, HCL Europe; +Cc: xenomai

On 07/09/2012 07:55 PM, Jorge Ramirez Ortiz, HCL Europe wrote:
> hi Gilles Not sure I understand now. Let's say that I also need to
> place a mutex on that shared region to be shared between other
> Xenomai applications. The mutex would obviusly be wrapped by the
> posix skin but not the system5 shared request. Would that work?? 
> thanks for all the help

Yes, it should work. What is hard to get right however is synchronizing
the various processes accessing the shared region so that
pthread_mutex_init is called once and only once.

-- 
                                                                Gilles.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Xenomai] shared memory segments
  2012-07-09 18:02     ` Gilles Chanteperdrix
@ 2012-07-09 18:19       ` Jorge Ramirez Ortiz,  HCL Europe
  2012-07-09 18:29         ` Gilles Chanteperdrix
  0 siblings, 1 reply; 7+ messages in thread
From: Jorge Ramirez Ortiz,  HCL Europe @ 2012-07-09 18:19 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

I can create an extra shared region in the library of sizeof(int) opened with exclusive access to behave as a lock to the mutex initialization I suppose.
ah another question, will I have to mlock_all the library?
________________________________________
From: Gilles Chanteperdrix [gilles.chanteperdrix@xenomai.org]
Sent: 09 July 2012 19:02
To: Jorge Ramirez Ortiz,  HCL Europe
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] shared memory segments

On 07/09/2012 07:55 PM, Jorge Ramirez Ortiz, HCL Europe wrote:
> hi Gilles Not sure I understand now. Let's say that I also need to
> place a mutex on that shared region to be shared between other
> Xenomai applications. The mutex would obviusly be wrapped by the
> posix skin but not the system5 shared request. Would that work??
> thanks for all the help

Yes, it should work. What is hard to get right however is synchronizing
the various processes accessing the shared region so that
pthread_mutex_init is called once and only once.

--
                                                                Gilles.


::DISCLAIMER::
----------------------------------------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents
(with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates.
Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the
views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and / or publication of this message without the prior written consent of authorized representative of
HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately.
Before opening any email and/or attachments, please check them for viruses and other defects.

----------------------------------------------------------------------------------------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Xenomai] shared memory segments
  2012-07-09 18:19       ` Jorge Ramirez Ortiz,  HCL Europe
@ 2012-07-09 18:29         ` Gilles Chanteperdrix
  0 siblings, 0 replies; 7+ messages in thread
From: Gilles Chanteperdrix @ 2012-07-09 18:29 UTC (permalink / raw)
  To: Jorge Ramirez Ortiz, HCL Europe; +Cc: xenomai

On 07/09/2012 08:19 PM, Jorge Ramirez Ortiz, HCL Europe wrote:
> I can create an extra shared region in the library of sizeof(int)
> opened with exclusive access to behave as a lock to the mutex
> initialization I suppose. ah another question, will I have to
> mlock_all the library?

You have to mlockall the process memory before calling xenomai services,
yes.

-- 
                                                                Gilles.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-07-09 18:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-09 10:26 [Xenomai] shared memory segments Jorge Ramirez Ortiz,  HCL Europe
2012-07-09 12:38 ` Gilles Chanteperdrix
2012-07-09 17:46 ` Gilles Chanteperdrix
2012-07-09 17:55   ` Jorge Ramirez Ortiz,  HCL Europe
2012-07-09 18:02     ` Gilles Chanteperdrix
2012-07-09 18:19       ` Jorge Ramirez Ortiz,  HCL Europe
2012-07-09 18:29         ` Gilles Chanteperdrix

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.