From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Phil Mitchell <p.mitch@gmail.com>
Cc: Xenomai Mailing List <xenomai@xenomai.org>
Subject: Re: [Xenomai] Why does mqueue.h define mqd_t as unsigned
Date: Thu, 9 Apr 2015 23:07:13 +0200 [thread overview]
Message-ID: <20150409210713.GH20752@hermes.click-hack.org> (raw)
In-Reply-To: <CAJZRki9RpfcQQ+c8oz1bJ7RsFQE4MrsQdULxvHAuh-STi0fhkQ@mail.gmail.com>
On Thu, Apr 09, 2015 at 04:52:26PM -0400, Phil Mitchell wrote:
> Dear All,
>
> mqueue.h defines mqd_t as an unsigned long. The function mq_open returns
> type mqd_t and states that -1 is returned in case of error.
>
> Is mqd_t defined incorrectly or am I missing something?
The specification does not say what mqd_t should be and says that
mq_open returns (mqd_t)-1, not -1, and (unsigned long)-1 is valid,
so, this is valid even if a bit strange. mqd_t is an opaque type for
the user anyway, so its actual type should not matter to you.
But in fact we do not even need a long type since what is returned
is a file descriptor, so, we could have typedef int mqd_t like
glibc.
--
Gilles.
next prev parent reply other threads:[~2015-04-09 21:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-09 20:52 [Xenomai] Why does mqueue.h define mqd_t as unsigned Phil Mitchell
2015-04-09 21:07 ` Gilles Chanteperdrix [this message]
2015-04-10 18:55 ` Gilles Chanteperdrix
2015-04-09 21:11 ` Paul Janzen
2015-04-09 22:09 ` Lennart Sorensen
2015-04-09 22:17 ` Gilles Chanteperdrix
2015-04-09 22:29 ` Gilles Chanteperdrix
2015-04-09 23:17 ` Lowell Gilbert
2015-04-10 14:44 ` Lennart Sorensen
2015-04-10 14:50 ` Gilles Chanteperdrix
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150409210713.GH20752@hermes.click-hack.org \
--to=gilles.chanteperdrix@xenomai.org \
--cc=p.mitch@gmail.com \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.