Sys V shared mem ??

notes at hcx1.UUCP notes at hcx1.UUCP
Fri Nov 14 09:09:43 AEST 1986


I have a question concerning System V.2 and shared memory.  It appears
(and I may be wrong) possible to do a shared memory attach into your
data region (we have System V source in house and I can't find any
checks that prevent this) . That is something like:

   int shmid, shmflg;
   char buf[1024];
   .
   .
   (get shmid, set shmflg, etc.)
   .
   .
   shmat (shmid, buf, shflg);

   and access the shared memory segemnt as buf[n].  The reason for doing
something like this is to save one indirection over the normal method
of just letting shmat() return a pointer the shared memory segment.

   My question is: What happens to the original contents of buf and
all the data objects declared after it ?
--------
Gil Pilz                                 ...!allegra!novavax!hcx1!gwp



More information about the Comp.unix.questions mailing list