IPC facilities (shared memory)

Dominick Samperi samperi at mancol.UUCP
Thu Mar 17 16:18:51 AEST 1988


>In article <150 at marob.MASA.COM> samperi at marob.UUCP (Dominick Samperi) writes:
>| In article <9844 at steinmetz.steinmetz.UUCP> Bill Davidsen writes:
>| >
>| >  SysV shared memory segments are inherited by the child, like any other
>| >open handle. If you open the segment and then do a fork, the child has
>| >access. If you fork and then open, the child will have to open, too.

I was told recently (by Amy Snader) that the SVID says that attached
shared memory segments are indeed inherited by forked children, so you
(and Xenix) are correct, "officially." It may also be true that it
is not necessary for forked child processes to reattach under System V/AT,
but I haven't checked this yet. On the other hand, I learned how to use
the IPC facilities on a 3B2/300, with very little documentation and no
examples, and I found by trial and error that the address that is returned
to a parent process by shmat() is not valid for its forked children; they
must explicitly attach the segment, using the shmid that was returned to the
parent by shmget().
-- 
Dominick Samperi, Manhattan College, NYC
    manhat!samperi at NYU.EDU           ihnp4!rutgers!nyu.edu!manhat!samperi
    philabs!cmcl2!manhat!samperi     ihnp4!rutgers!hombre!samperi
              (^ that's an ell)      uunet!swlabs!mancol!samperi



More information about the Comp.unix.wizards mailing list