Path: gmd.de!newsserver.jvnc.net!netnews.upenn.edu!msuinfo!agate!
howland.reston.ans.net!gatech!taco.cc.ncsu.edu!jlnance
From: jlna...@eos.ncsu.edu (JAMES LEWIS NANCE)
Newsgroups: comp.os.linux.development
Subject: suggestion for IPC feature/bugfix
Date: 5 Apr 1994 11:35:55 GMT
Organization: North Carolina State University, Project Eos
Lines: 28
Distribution: world
Message-ID: <2nrier$hp4@taco.cc.ncsu.edu>
Reply-To: jlna...@eos.ncsu.edu (JAMES LEWIS NANCE)
NNTP-Posting-Host: c11063-401dan.ece.ncsu.edu
Keywords: IPC
Originator: jlna...@chow2.ece.ncsu.edu


Hello Linuxers,
     I have recently begun learning about SYSV IPC on my linux machine.  One
thing I discovered is that if you allocate shared memory it stays allocated
even after the program exits unless you mark it for deletion (yes, I know
it says this in the man page).  I understand
that this is a feature because it allows processes to communicate through
shared memory even if they are not running at the same time.  The problem
I found is that if you create using the IPC_PRIVATE flag, and do not mark
it for deletion, it still exists when the program terminates, and I do not
think you can get rid of it.  This bothers me because it is a way for a user
to effectivly bring down a linux machine, and the only cure that I can find
is to reboot the machine.  What I would like to prepose is this.  Create a
/proc/shared directory.  In this directory there would be a file corrosponding
to every shared memory segment.  The program using shared memory would 
effectivly have this file open.  When the segment was marked for deletion this
file would be deleated, but programs could still access the memory, just like
programs can still access files which have been deleted if they already have
them open.  When all the files using that shared memory exited, the shared
memory would be lost.  However, if a programmer forgot to delete a shared
memory segment, it would still exist in /proc/shared, and could be deleted
using the rm command.  Prehaps it would even be possible to implement shared
memory by mmaping this file?  Anyway, I just wanted to toss this idea out.
Prehaps there is already a way to accomplish what I want to do?

Thanks for listening,

Jim Nance