Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

shm_open POSIX Shared Memory

797 views
Skip to first unread message

Kevind

unread,
Sep 30, 2003, 11:19:30 AM9/30/03
to

I get the following error when trying to use shm_open
"Function not implemented"

My kernel has System V IPC configured and I thought POSIX
Shared Memory is required for kernel 2.4.x.


Thanks

Kasper Dupont

unread,
Sep 30, 2003, 11:21:51 AM9/30/03
to

Did you mount /dev/shm?

--
Kasper Dupont -- der bruger for meget tid paa usenet.
For sending spam use mailto:aaa...@daimi.au.dk
Their business was zero and it was shrinking.

Kevin

unread,
Sep 30, 2003, 11:37:40 AM9/30/03
to
Kasper Dupont wrote:
> Kevind wrote:
>
>>I get the following error when trying to use shm_open
>> "Function not implemented"
>>
>>My kernel has System V IPC configured and I thought POSIX
>>Shared Memory is required for kernel 2.4.x.
>
>
> Did you mount /dev/shm?
>

No I have not mounted /dev/shm. It doesn't exist already on my system
How is it created? mknod?

Thanks
Kevin

Adam Dyga

unread,
Sep 30, 2003, 12:29:42 PM9/30/03
to
Kasper Dupont wrote:

> Kevind wrote:
>>
>> I get the following error when trying to use shm_open
>> "Function not implemented"
>>
>> My kernel has System V IPC configured and I thought POSIX
>> Shared Memory is required for kernel 2.4.x.
>
> Did you mount /dev/shm?

It has nothing to do with /dev/shm, I don't have it on my system, but shared
memory works.

--
Greets
adeon

Adam Dyga

unread,
Sep 30, 2003, 12:30:18 PM9/30/03
to
Kevind wrote:

>
> I get the following error when trying to use shm_open
> "Function not implemented"
>

Could you show your code snip?

--
Greets
adeon

Adam Dyga

unread,
Sep 30, 2003, 12:32:15 PM9/30/03
to
Adam Dyga wrote:


> It has nothing to do with /dev/shm, I don't have it on my system, but
> shared memory works.

I meant shared memory functions (ie. shm_open) work

--
Greets
adeon

Kasper Dupont

unread,
Sep 30, 2003, 12:44:28 PM9/30/03
to
Kevin wrote:
>
> No I have not mounted /dev/shm. It doesn't exist already on my system
> How is it created? mknod?

You create it with mkdir, and then add this to your fstab:

none /dev/shm tmpfs rw 0 0

Also verify that tmpfs is actually listed in the list of
supported filesystems:

/proc/filesystems

Kasper Dupont

unread,
Sep 30, 2003, 12:45:22 PM9/30/03
to

I just tried unmounting /dev/shm on one system.
shm_open does give ENOSYS in that case.

Kevin

unread,
Sep 30, 2003, 1:09:56 PM9/30/03
to
Adam Dyga wrote:
> Kevind wrote:
>
>
>>I get the following error when trying to use shm_open
>> "Function not implemented"
>>
>
>
> Could you show your code snip?
>

I added the following line to the /etc/fstab
none /dev/shm tmpfs defaults 0 0
and mounted /dev/shm and it seemed to take it,
although there is still no shm in the dev directory.

I am getting a new shm_open error for /tmp/testshm: No such file or
directory. Although I am using O_CREATE? but I will
struggle a little while first and open a new thread if I need.

Thanks everyone.

Code snippet, someone may find it useful. I am starting with code from
W.R. Stevens Network Programming.
passed oflag = O_RDWR | O_CREAT | O_EXCL, FILE_MODE

if ( (fd = shm_open(pathname, oflag, mode)) == -1)
err_sys("shm_open error for %s", pathname);
return(fd);

kevind

unread,
Sep 30, 2003, 1:19:01 PM9/30/03
to
Adam Dyga wrote:
> Kevind wrote:
>
>
>>I get the following error when trying to use shm_open
>> "Function not implemented"
>>
>
>
> Could you show your code snip?
>

I added the following line to /etc/fstab


none /dev/shm tmpfs defaults 0 0

and mounted /dev/shm.

I seemed to take the mount, although no /dev/shm exists.

I am getting a new shm_open error: No such file or directory even
though I am using O_CREAT. I will study this and open a new thread if
I can't figure it out.

I am starting with W.R. Stevens Network programming code and the snippet
is as follows.

int fd;
// the passed oflag = O_RDWR | O_CREAT | O_EXCL, FILE_MODE;


if ( (fd = shm_open(pathname, oflag, mode)) == -1)
err_sys("shm_open error for %s", pathname);
return(fd);


Thanks everyone.

0 new messages