* shm.cc (shmctl): On IPC_RMID don't unmap views and don't close handle
if the map is still referenced to emulate Linux and BSD behaviour.
This commit is contained in:
parent
92beb4638f
commit
5c8426d50e
|
@ -1,3 +1,8 @@
|
||||||
|
2007-11-05 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* shm.cc (shmctl): On IPC_RMID don't unmap views and don't close handle
|
||||||
|
if the map is still referenced to emulate Linux and BSD behaviour.
|
||||||
|
|
||||||
2007-11-05 Corinna Vinschen <corinna@vinschen.de>
|
2007-11-05 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* shm.cc (shmctl): On IPC_RMID also unmap all views on shared mem
|
* shm.cc (shmctl): On IPC_RMID also unmap all views on shared mem
|
||||||
|
|
|
@ -265,22 +265,20 @@ 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;
|
bool in_use = false;
|
||||||
SLIST_FOREACH_SAFE (sph_entry, &sph_list, sph_next,
|
shm_attached_list *sph_entry;
|
||||||
sph_next_entry)
|
SLIST_FOREACH (sph_entry, &sph_list, sph_next)
|
||||||
{
|
{
|
||||||
if (sph_entry->hdl == ssh_entry->hdl)
|
if (sph_entry->hdl == ssh_entry->hdl)
|
||||||
{
|
{
|
||||||
SLIST_REMOVE (&sph_list, sph_entry, shm_attached_list,
|
in_use = true;
|
||||||
sph_next);
|
break;
|
||||||
/* ...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 if it's not in use anymore. */
|
||||||
CloseHandle (ssh_entry->hdl);
|
if (!in_use)
|
||||||
|
CloseHandle (ssh_entry->hdl);
|
||||||
delete ssh_entry;
|
delete ssh_entry;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue