From: Alex Vinokur on
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
From: Zeljko Vrba on
On 2009-12-19, Alex Vinokur <alex.vinokur(a)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.

From: WANG Cong on
On 12/19/09 22:34, Alex Vinokur <alex.vinokur(a)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.

From: Maxim Yegorushkin on
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