Posix shared memory problem

Lothar Scholz scholz at scriptolutions.com
Sun May 10 06:25:28 UTC 2009

Hello Garrett,

Sunday, May 10, 2009, 7:00:16 AM, you wrote:

GW> In
GW> <mit.lcs.mail.freebsd-arch/19461540.20090510064924 at scriptolutions.com>
GW> scholz at scriptolutions.com writes:

>>JT> shm_open/shm_unlink refer to the filesystem; they are fairly direct
>>JT> wrappers around open and unlink.
>>Question is where are they stored?

GW> In the fileststem, in the path that you specify.  They are just
GW> ordinary files.

GW> There was some thought that this was a bad (or at least
GW> not-like-Linux) way of implementing this feature, so I believe
GW> more-recent versions of FreeBSD do it differently.  When I wrote this
GW> code, I could not see any reason for the "path" argument to be
GW> interpreted differently from any other path.

Oh thats a very very bad idea.

First of all you can't use '/' if you want stay portable.
It is also just a maximum of 13 char long (says the FreeBSD 6.X man page)
and usually you now pass names like
"com.mycompany.myproduct.mypurpose" as names to prevent namespace

The path has nothing to do with the filesystem, it's a separate
namespace. Let alone that semaphores and shared memory already use the
same namespace is something i didn't expect on Linux.

Now it is clear where my problem is and i go to a mmap to a $HOME/.
file. Not nice but if anybody gives a shit about compatibility
(backward and to other systems before implementing stuff) it is
the only way.

Best regards,
 Lothar Scholz                mailto:scholz at scriptolutions.com

More information about the freebsd-arch mailing list