IPC_PRIVATE in shared memory
James Logan III
logan at vsedev.VSE.COM
Thu Jun 2 01:59:50 AEST 1988
I am unable to find any documentations at all on the
IPC_PRIVATE key that can be passed to the shmget()
system call.
IPC_PRIVATE is defined in /usr/include/sys/ipc.h and
has only one ambiguous comment, "private key". Does
this mean that the region that I attach will be
accessable only to my process? If so, what is the
point to bothering the operating system for shared
memory when the malloc() function yields the same
results?
The reason I ask is that I would like to share memory
between two processes -- one parent and one child.
This program will be run by more than one user at a
time, therefore I cannot just hard-code some key in the
program. The only way that I know to solve the problem
is to call shmget() with the IPC_EXCL flag in a loop
that tries keys from 1 to some number. (Where do I
stop? How many keys are possible under SysV? 2^32?)
If the IPC_PRIVATE flag can be used to set up a segment
that is shared between a parent and a child process but
is invisible to other user's processes, this would be a
more simplistic solution but I don't know what UNIX's
idea of private is in this case.
If anyone has done anything like this or has any ideas,
please let me know.
--
--
ron at vsedev.vse.com (Ron Flax)
uucp: ..!uunet!vsedev!ron
inet: ron%vsedev.vse.com at uunet.uu.net
More information about the Comp.lang.c
mailing list