summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/shm.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2007-11-05 10:15:31 +0000
committerCorinna Vinschen <corinna@vinschen.de>2007-11-05 10:15:31 +0000
commit92beb4638f08452261beab4629d74aee759b1732 (patch)
tree6c38a782a41ecd3bdf97b5056d3bad4a8748956c /winsup/cygwin/shm.cc
parent026d54aa230bfed6301995374fb163ef3b5b4c25 (diff)
downloadcygnal-92beb4638f08452261beab4629d74aee759b1732.tar.gz
cygnal-92beb4638f08452261beab4629d74aee759b1732.tar.bz2
cygnal-92beb4638f08452261beab4629d74aee759b1732.zip
* shm.cc (shmctl): On IPC_RMID also unmap all views on shared mem
as well as connected shm_attached_list entry.
Diffstat (limited to 'winsup/cygwin/shm.cc')
-rw-r--r--winsup/cygwin/shm.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/winsup/cygwin/shm.cc b/winsup/cygwin/shm.cc
index f6cc30baf..27cc9843c 100644
--- a/winsup/cygwin/shm.cc
+++ b/winsup/cygwin/shm.cc
@@ -265,6 +265,19 @@ shmctl (int shmid, int cmd, struct shmid_ds *buf)
{
if (ssh_entry->shmid == shmid)
{
+ shm_attached_list *sph_entry, *sph_next_entry;
+ SLIST_FOREACH_SAFE (sph_entry, &sph_list, sph_next,
+ sph_next_entry)
+ {
+ if (sph_entry->hdl == ssh_entry->hdl)
+ {
+ SLIST_REMOVE (&sph_list, sph_entry, shm_attached_list,
+ sph_next);
+ /* ...unmap all views for this handle... */
+ UnmapViewOfFile (sph_entry->ptr);
+ delete sph_entry;
+ }
+ }
SLIST_REMOVE (&ssh_list, ssh_entry, shm_shmid_list, ssh_next);
/* ...and close the handle. */
CloseHandle (ssh_entry->hdl);