This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: cygipc-1.11 SHM-patch: fork, handling in ipc-daemon
- From: "Robert Collins" <robert dot collins at itdomain dot com dot au>
- To: "Michael Haubenwallner" <michael dot haubenwallner at salomon dot at>,"Charles Wilson" <cwilson at ece dot gatech dot edu>
- Cc: <cygwin at cygwin dot com>
- Date: Sat, 19 Jan 2002 10:38:58 +1100
- Subject: Re: cygipc-1.11 SHM-patch: fork, handling in ipc-daemon
- References: <3C482133.E3C673D2@salomon.at>
===
----- Original Message -----
From: "Michael Haubenwallner" <michael.haubenwallner@salomon.at>
> - It is not clear what happens in following circumstance:
> 1) the first process creates a shm
> 2) a second one attaches to it
> 3) now the second process dies without detaching
> 4) the first process removes the shm with shmctl(IPC_RMID),
> but the ipc-daemon was sleeping and did not remove the
> second attachment-entry early enough to have shm_nattch==0,
> which must be the case in shmctl() to really remove the shm
> by the caller of shmctl(IPC_RMID).
>
> What IMHO surely not should happen is that a shmid with
> shm_nattch==0 remains with having the destroy-flag set.
> So the ipc-daemon must remove a shm in this state,
> including the tmp-file.
In this case, the daemon should wait on all the processes that are
attached, so it gets woken up when a process quits. Alternatively, you
could queue the removal, prevent now attachments, and when the second
process termination is 'noticed' perform the removal.
Rob
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/