Xref: utzoo comp.unix.questions:7352 comp.lang.c:10525 Path: utzoo!attcan!uunet!vsedev!logan From: logan@vsedev.VSE.COM (James Logan III) Newsgroups: comp.unix.questions,comp.lang.c Subject: IPC_PRIVATE in shared memory Message-ID: <1120@vsedev.VSE.COM> Date: 1 Jun 88 15:59:50 GMT Reply-To: logan@vsedev.VSE.COM (James Logan III) Organization: VSE Software Development Lab Lines: 35 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@vsedev.vse.com (Ron Flax) uucp: ..!uunet!vsedev!ron inet: ron%vsedev.vse.com@uunet.uu.net