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

shm_open() vs. shmget(); shm_open() vs. open()

2,156 views
Skip to first unread message

Alex Vinokur

unread,
Dec 19, 2009, 9:34:43 AM12/19/09
to
Hi,

1. shm_open() vs. shmget()

int fd = shm_open(...);

We can't see that shared memory segment via icps.

How can we see all shared memory segments created via shm_open?


2. shm_open() vs. open()

int fd1 = shm_open(...);
int fd2 = open();

What can we do via fd1 but can't do via fd2?


Alex

Zeljko Vrba

unread,
Dec 20, 2009, 2:36:08 AM12/20/09
to
On 2009-12-19, Alex Vinokur <alex.v...@gmail.com> wrote:
> Hi,
>
> 1. shm_open() vs. shmget()
>
> int fd = shm_open(...);
>
> We can't see that shared memory segment via icps.
>
> How can we see all shared memory segments created via shm_open?
>
AFAIK, there is no standardized way to view and manipulate POSIX IPC objects
(SHM segments, message queues and semaphores).

>
> 2. shm_open() vs. open()
>
> int fd1 = shm_open(...);
> int fd2 = open();
>
> What can we do via fd1 but can't do via fd2?
>

I don't know.

WANG Cong

unread,
Dec 20, 2009, 3:42:39 AM12/20/09
to
On 12/19/09 22:34, Alex Vinokur <alex.v...@gmail.com> wrote:

> Hi,
>
> 1. shm_open() vs. shmget()
>
> int fd = shm_open(...);
>
> We can't see that shared memory segment via icps.

You must mean 'ipcs'.

>
> How can we see all shared memory segments created via shm_open?
>

No way, because the sem you created via shm_open() is based
on files, no memory. Thus you can't see any related memory
segments.

>
> 2. shm_open() vs. open()
>
> int fd1 = shm_open(...);
> int fd2 = open();
>
> What can we do via fd1 but can't do via fd2?

Almost nothing, IMO.

In fact on Linux shm_open() are implemented as tmpfs files,
nothing particular than other regular files.

--
Live like a child, think like the god.

Maxim Yegorushkin

unread,
Dec 20, 2009, 11:24:39 AM12/20/09
to
On 19/12/09 14:34, Alex Vinokur wrote:
> Hi,
>
> 1. shm_open() vs. shmget()
>
> int fd = shm_open(...);
>
> We can't see that shared memory segment via icps.
>
> How can we see all shared memory segments created via shm_open?

On Linux you can `ls -l /dev/shm`, provided tmpfs is used.

--
Max

0 new messages