System V shared memory and Ultrix ?

Bob Lenk rml at hpfcdc.HP.COM
Sat Sep 27 05:46:55 AEST 1986


> > 	Is the shared memory segment automatically destroyed if no process has
> > it "open" ?
> 
> However, there are two FLAGs (at least on my vax) SHM_CLEAR and SHM_DEST
> that clear the segment on the next attach and destroy it when no one is
> attached to it, respectively.  cat /usr/include/sys/shm.h to see if they
> are on you machine as well.

These flags are in <sys/shm.h> on System V implementations, but they are
not documented or accessable to the user (eg. through shmget or shmctl).
The only way to get something like what was requested is to explicitly
remove the segement (with shmctl (,IPC_RMID,)); this must be done after
the last attach (as subsequent attaches will fail).  What the implementation
does, if any processes have the segement attached at the time of the IPC_RMID,
is to set the SHM_DEST bit.  On the last detach, the segment is actually
destroyed.  

			Bob Lenk
			{ihnp4, hplabs}!hpfcla!rml



More information about the Comp.unix.wizards mailing list