Message queues (System V)
Conor P. Cahill
cpcahil at virtech.uucp
Sun Mar 4 03:23:17 AEST 1990
In article <7114 at lynx.UUCP> m5 at lynx.uucp (Mike McNally) writes:
> [ story of how kernel does not delete unused message queues deleted]
>Of course, because the
>IPC_PRIVATE key was used, by definition no other process will ever be able
>to "open" the queue in the future.
This is not true. As long as someone has saved, or has access to the message
id, the queue can be re-used by any process.
This is the same for all of the System V IPCs. None of them will be
removed without an explicit remove operation (via the *ctl()). Shared memory
is a special case where the remove will not take place until there are no
longer any processes attached to the segment. That way you can create the
segment, attach to it, and then call the remove. Once your program exits,
the segment will go away.
>I realize that it would be "nice" to do a msgctl() to get rid of the thing,
>but it seems a little user-hostile for the kernel to not do this automatically.
>Is any purpose served by keeping the queue around?
Maybe, maybe not. It depends upon the application, but I am glad that the
kernel doesn't force the issue. If it had forced the issue, you (or somebody
else) would be complaining that there is no way to keep the queue around.
This way you get to make the choice.
--
Conor P. Cahill (703)430-9247 Virtual Technologies, Inc.,
uunet!virtech!cpcahil 46030 Manekin Plaza, Suite 160
Sterling, VA 22170
More information about the Comp.unix.wizards
mailing list