Commit db52c656 authored by Florian Bezdeka's avatar Florian Bezdeka Committed by Jan Kiszka
Browse files

cobalt/posix/mqueue: Export created mqueues to procfs



Exporting created mqueues to /proc/xenomai/registry/posix/mqueue helps
to identify resource leaks by making mqueues visible. The content of all
created virtual files is empty. Removal of such files is not possible
and reports "operation not supported".
Signed-off-by: default avatarFlorian Bezdeka <florian.bezdeka@siemens.com>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent b3dc0b13
...@@ -87,6 +87,39 @@ static struct mq_attr default_attr = { ...@@ -87,6 +87,39 @@ static struct mq_attr default_attr = {
static LIST_HEAD(cobalt_mqq); static LIST_HEAD(cobalt_mqq);
#ifdef CONFIG_XENO_OPT_VFILE
static int mq_vfile_show(struct xnvfile_regular_iterator *it, void *data)
{
return 0;
}
static struct xnvfile_regular_ops mq_vfile_ops = {
.show = mq_vfile_show,
};
static struct xnpnode_regular __mq_pnode = {
.node = {
.dirname = "mqueue",
.root = &posix_ptree,
.ops = &xnregistry_vfreg_ops,
},
.vfile = {
.ops = &mq_vfile_ops,
},
};
#else /* !CONFIG_XENO_OPT_VFILE */
static struct xnpnode_link __mq_pnode = {
.node = {
.dirname = "mqueue",
}
};
#endif /* !CONFIG_XENO_OPT_VFILE */
static inline struct cobalt_msg *mq_msg_alloc(struct cobalt_mq *mq) static inline struct cobalt_msg *mq_msg_alloc(struct cobalt_mq *mq)
{ {
if (list_empty(&mq->avail)) if (list_empty(&mq->avail))
...@@ -352,7 +385,8 @@ static int mq_open(int uqd, const char *name, int oflags, ...@@ -352,7 +385,8 @@ static int mq_open(int uqd, const char *name, int oflags,
} }
xnlock_get_irqsave(&nklock, s); xnlock_get_irqsave(&nklock, s);
err = xnregistry_enter(mq->name, mq, &mq->handle, NULL); err = xnregistry_enter(mq->name, mq, &mq->handle,
&__mq_pnode.node);
if (err < 0) if (err < 0)
--mq->refs; --mq->refs;
else else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment