bengsig@oracle.nl (Bjorn Engsig) (05/17/89)
Is it safe to do the following (in all known Unix'es): - Program 1 does a succesful create of a shared memory segment (shmget), attaches to it (shmat), saves the shm identifier (NOT the key) in a file, and the program stays alive. - Program 2 reads the file, uses shmat only (NO shmget) to attach to the shared memory, and stays alive. The real point is: Is it safe to attach to an existing shared memory (for which you have the permission) using shmat with a known shmid, without getting the shmid by a call to shmget? -- Bjorn Engsig, ORACLE Europe \ / "Hofstadter's Law: It always takes Path: mcvax!orcenl!bengsig X longer than you expect, even if you Domain: bengsig@oracle.nl / \ take into account Hofstadter's Law"
bengsig@oracle.nl (Bjorn Engsig) (05/24/89)
In article <331.nlhp3@oracle.nl> I wrote: > >The real point is: Is it safe to attach to an existing shared memory (for >which you have the permission) using shmat with a known shmid, without >getting the shmid by a call to shmget? Thank you for all the replies. This is a summary of them: - All who have tried it, say it works in their case. - A few who have kernel source access to AT&T SysV, say it does work. - A single one reads (rather mails) SVID loudly for my, where it says "... *a* shared memory identifier ...", NOT specifying that it has to come from a shmget call. - A singly reply tells me not to do it without really mentioning why, just that it is "dangerous". - Nobody had examples where it did not work. Anyway, thank you again. -- Bjorn Engsig, ORACLE Europe \ / "Hofstadter's Law: It always takes Path: mcvax!orcenl!bengsig X longer than you expect, even if you Domain: bengsig@oracle.nl / \ take into account Hofstadter's Law"