* shm.cc (shmctl): On IPC_RMID also unmap all views on shared mem

as well as connected shm_attached_list entry.
This commit is contained in:
Corinna Vinschen 2007-11-05 10:15:31 +00:00
parent 026d54aa23
commit 92beb4638f
2 changed files with 18 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2007-11-05 Corinna Vinschen <corinna@vinschen.de>
* shm.cc (shmctl): On IPC_RMID also unmap all views on shared mem
as well as connected shm_attached_list entry.
2007-10-31 Corinna Vinschen <corinna@vinschen.de> 2007-10-31 Corinna Vinschen <corinna@vinschen.de>
* net.cc (load_ipv6_funcs): Use MAX_PATH instead of CYG_MAX_PATH. * net.cc (load_ipv6_funcs): Use MAX_PATH instead of CYG_MAX_PATH.

View File

@ -265,6 +265,19 @@ shmctl (int shmid, int cmd, struct shmid_ds *buf)
{ {
if (ssh_entry->shmid == shmid) 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); SLIST_REMOVE (&ssh_list, ssh_entry, shm_shmid_list, ssh_next);
/* ...and close the handle. */ /* ...and close the handle. */
CloseHandle (ssh_entry->hdl); CloseHandle (ssh_entry->hdl);