Posix shared memory problem

Lothar Scholz scholz at scriptolutions.com
Sun May 10 04:53:25 UTC 2009


Hello Jilles,

Saturday, May 9, 2009, 10:07:24 PM, you wrote:

JT> On Sat, May 09, 2009 at 08:31:15PM +0200, Lothar Scholz wrote:
>> Thanks for solving the posix semaphore problem. But with shared memory
>> there comes the next issue:

>> int main() {
>>   int m;
>>   shm_unlink("/barfoo");
>>   m = shm_open("/barfoo", O_RDWR|O_CREAT|O_EXCL, S_IRWXU);
>>   if (m == 1) perror("shm_open error");
>> }

>> i always get permission denied error, and i tried many values
>> for flags and mode? I can only get this working as root but not
>> as a normal user.

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?
In Linux it is "/dev/shm".

In my case it looks like the directory for shm_open files has some
wrong access rights so that a normal user can't generate it.

JT> POSIX suggests making the pathname a configuration option;
JT> alternatively, using a directory for temporary files such as /tmp could
JT> work.

I will try this hack  soon if nobody comes up with a solution.


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



More information about the freebsd-arch mailing list