Open GoogleCodeExporter opened 8 years ago
I doubt this can be emulated on most operating systems.
By "path names not unique" you mean the path name is the same for different
entries and you would like to differentiate them? Is that your use case?
If that's the case can't you just use the address ('addr')?
Original comment by g.rodola
on 20 Nov 2013 at 11:23
Exactly, I need to differentiate the anonymous ("SYSV00000000") shared memory
blocks.
In the use case you described, it is definitively necessary because I need to
detect related processes, which share an unique memory segment (And are
therefore part of the same logical application).
The mapped address is not unique because different processes can map the same
shared memory segment at different addresses in their address space.
On the other hand, the inode really represent the shared memory segment: It is
equivalent to the shmid returned by the command ipcs.
I guess there is something very similar on all Unices, BSD etc... On Windows,
there is probably an unique integer id which could serve the same purpose.
Thanks
Original comment by remi.cha...@gmail.com
on 20 Nov 2013 at 11:48
...but what would you do after you can differentiate between unique memory
mappings?
I'm not sure I'm understanding your use case, I'm sorry (maybe some pseudo come
could help?).
Generally speaking, if the use case is not common enough and the feature is not
portable across many platform I usually decide not to add it. My impression so
far is that this is the case (but again: I'm probably misinterpreting the use
case).
Original comment by g.rodola
on 20 Nov 2013 at 6:31
One of the use of shared memory segments is to have different processes
communicating with each other. For this, they need to map the segment in their
memory space, using the unique shared id, called "shmid" by the command "ipcs".
The pathname of the shared memory segment is usable only if this is a file
mapped into memory, but this is a special case (Most read-only files mapped in
memory for ease of access). For interprocess communication, memory segments are
defined by their shmid (Equivalent to an inode), not by their path names which
is non-existent (Or given a default value): They are anonymous.
In other words, memory segments used in interprocess communications cannot be
used without their id (That is, the inode as returned by the /proc file
system), simply because they cannot be identified. Internally, Linux does not
use the pathname, but of course the inode.
For example, these ids are necessary to check if two different applications are
communicating via shared memory segments: This technology is widely used (I can
give specific example by email, if necessary).
It would make sense, for example to concatenate the shmid to the string
"SYSV00000000" which is not usable anyway.
On Solaris, you might use this id:
http://www.cs.cf.ac.uk/Dave/C/node27.html
Thanks
Original comment by remi.cha...@gmail.com
on 20 Nov 2013 at 8:50
Original issue reported on code.google.com by
remi.cha...@gmail.com
on 20 Nov 2013 at 11:12