mq_open

Hello.
When mq_open() is used in a process it creates an entry under /dev/mqueue
When the process then ends then the entry under /dev/mqueue is still there.

Is it possible to have the entry under /dev/mqueue disapperar automatically
as soon as the process end/dies?
In the same way as it works for ‘/dev/ser1’ for example.

regards, MP

Mats Pettersson <mats.pettersson@wavium.se> wrote:

When mq_open() is used in a process it creates an entry under /dev/mqueue
When the process then ends then the entry under /dev/mqueue is still there.
Is it possible to have the entry under /dev/mqueue disapperar automatically
as soon as the process end/dies?

mq_unlink()

Yes, but then the process has to do this itself I guess. I have the feeling
that for some device drivers (like /dev/ser1) it is not the device-driver
process
itself that removes the entry under /dev but rather the OS. Like when the
proces dies the OS removes its entries it has created under /dev .
but maybe that is not the way it works!?

regards, Mats P

“John Garvey” <jgarvey@qnx.com> wrote in message
news:acl7g7$5li$1@nntp.qnx.com

Mats Pettersson <> mats.pettersson@wavium.se> > wrote:
When mq_open() is used in a process it creates an entry under
/dev/mqueue
When the process then ends then the entry under /dev/mqueue is still
there.
Is it possible to have the entry under /dev/mqueue disapperar
automatically
as soon as the process end/dies?

mq_unlink()

Mats Pettersson <mats.pettersson@wavium.se> wrote:

Yes, but then the process has to do this itself I guess.

Of course; message queues have persistence just like regular files.

I have the feeling that for some device drivers (like /dev/ser1) it is
not the device-driver process itself that removes the entry under /dev
but rather the OS. Like when the proces dies the OS removes its entries
it has created under /dev . but maybe that is not the way it works!?

The “mqueue” server process itself has not died; it is responsible for
the name; semantics insist that the name remain until both the link
count and open reference count are 0 (of course, if “mqueue” were to
crash all such names would go away as you describe, but that is abnormal).

John Garvey <jgarvey@qnx.com> wrote:
: Mats Pettersson <mats.pettersson@wavium.se> wrote:
:> Yes, but then the process has to do this itself I guess.

: Of course; message queues have persistence just like regular files.

:> I have the feeling that for some device drivers (like /dev/ser1) it is
:> not the device-driver process itself that removes the entry under /dev
:> but rather the OS. Like when the proces dies the OS removes its entries
:> it has created under /dev . but maybe that is not the way it works!?

: The “mqueue” server process itself has not died; it is responsible for
: the name; semantics insist that the name remain until both the link
: count and open reference count are 0 (of course, if “mqueue” were to
: crash all such names would go away as you describe, but that is abnormal).

The docs for mq_open() should probably mention the persistence of mqueues
(sounds like a good name for a surrealist painting). I’ll fix the docs.
Thanks.


Steve Reid stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems

Mats Pettersson wrote:

Hello.
When mq_open() is used in a process it creates an entry under /dev/mqueue
When the process then ends then the entry under /dev/mqueue is still there.

Is it possible to have the entry under /dev/mqueue disapperar automatically
as soon as the process end/dies?
In the same way as it works for ‘/dev/ser1’ for example.

The queue server that comes with the Cogent API does this.
When the creator of the queue exits, the queue is destroyed.
It’s not API-compatible with mqueue, though. It is designed
to work within our portable messaging framework.

Cheers,
Andrew