> Hi All,
> 
> Is there any equivalent method in POSIX to find out
> the ipc information for sharedmemory or semaphores?
> Like if we execute this command:"
> ipcs -m
> 
> We get the following output:
> T ID KEY MODE OWNER GROUP
> Shared Memory:
> m 0 0x50000dcb --rw-r--r-- root root
> 
> 
> Similarly, Do we have any such equivalent way to
> determine the ipcs facilites for POSIX calls? If
> there is no equivalent command then can we write any
> program ourselves to determine all these
> information?
> Any help on this will be highly appreciated.

I'm not aware of any standards-defined command to do that, although
I haven't tried to find out whether any such are under discussion.

In the particular case of [Open]Solaris, I think it would be possible to
write such a program by looking at the implementation of shm_open()
(http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/port/rt/shm.c)
and in turn following that to the implementation of __pos4obj_open() and 
ultimately __pos4obj_name()
(http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/port/rt/pos4obj.c#122)
to see where the underlying objects were stored (typically under /tmp,
with naming conventions you have to reverse-engineer from __pos4obj_name() and 
the pos4obj.h header file).

Note: while shm_open() may be "stable", the implementation clearly is not,
since it has changed from being in /var/tmp in e.g. early Solaris 8, to
being in /tmp now, plus changes in the pathname relative to that point
(the former for efficiency, and the later perhaps to avoid collisions on long
names).  Therefore, any implemenation of a command to show existing
POSIX shared memory objects would have to be either part of whatever
{consolidation or project} "owns" the implementation (presumably there's
an ARC case somewhere that describes that, although I ave no idea if it is
public), or would have to have a "contract" with same, or would have to
accept the possibility of being broken with any patch or minor/micro release.

Additionally, showing some of the info that ipcs -a -m shows for SysV shared
memory would be difficult; for example, showing attach count might
involve duplicating some of the code in fuser(1m); there would be an
equivalent to at most one of owner vs creator uid/gid, no equivalent to "ID",
or "CPID"; and perhaps not exact equivalents to the various timestamps nor to
"LPID".  So it couldn't meaningfully produce identical output.

Still, a command for both this and the other POSIX IPC objects that behaves
somewhat similarly to how ipcs behaves for the corresponding SysV objects
_ought_ to be possible, IMO.  I think it would be very desirable to investigate
whether such a command might be under consideration for standardization,
and what other implementations if any have such a command, before
pursuing the creation of one.  Given that, such a command might be worth
having.
 
 
This message posted from opensolaris.org
_______________________________________________
opensolaris-discuss mailing list
[email protected]

Reply via email to