From: Ulrich Drepper <drepper@redhat.com>
To: Martijn Sipkema <m.j.w.sipkema@student.tudelft.nl>
Cc: Jakub Jelinek <jakub@redhat.com>,
linux-kernel@vger.kernel.org, Roland McGrath <roland@redhat.com>
Subject: Re: POSIX message queues should not allocate memory on send
Date: Fri, 14 May 2004 08:57:50 -0700 [thread overview]
Message-ID: <40A4EC7E.4010503@redhat.com> (raw)
In-Reply-To: <001001c439b0$db1af1e0$161b14ac@boromir>
Martijn Sipkema wrote:
> Indeed maybe returning ENOMEM from mq_send() is conforming to the
> standard.
Indeed, it is.
> What _is_ clear from the standard is that a queue is supposed to be
> allocated on creation, even if it may not be required.
Nothing is clear when it comes to the behavior. There are certainly
some aspects of a possible implementation which the designers of the
APIs had in mind, but this is absolutely no requirement.
> What use is a message queue for a realtime application when on
> mq_send() it may have to wait for memory allocation that may even
> fail?
That's a completely different issue. You want everybody to suffer
because of the requirements of have. This is the same as if you would
demand the overcommit is disable.
Yes, there are situations where the allocation-on-demand is not
desirable and the POSIX API description is indeed hinting at such uses.
But the APIs are useful even without having such hard requirements and
so far the people who developed the code have not seen this hard
realtime requirement.
If you have such requirements I suggest that you sit done and write some
extensions. I.e., do not replace the current default behavior, but
instead make it possible to force pre-allocation. I'd say the natural
way is to define a O_* flag which only mq_open() and mq_setattr()
understands. The former will get it in the second parameter, the latter
via the mq_flags field in the incoming struct mq_attr structure.
Something like O_PREALLOCATE. Again, the flag would only be needed for
message queues, so a bit other than the ones used by mq_open() can be
reused.
> Even if POSIX allows errors to be returned that are not in the function's
> ERRORS list, I don't think one should do this if it can be avoided.
Do your part to fulfill your niche-requirements.
--
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
next prev parent reply other threads:[~2004-05-14 15:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-14 10:30 POSIX message queues should not allocate memory on send Martijn Sipkema
2004-05-14 9:51 ` Jakub Jelinek
2004-05-14 11:09 ` Martijn Sipkema
2004-05-14 10:40 ` Jakub Jelinek
2004-05-14 12:42 ` Martijn Sipkema
2004-05-14 15:57 ` Ulrich Drepper [this message]
2004-08-15 0:12 ` Martijn Sipkema
2004-05-14 16:58 ` Chris Wright
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=40A4EC7E.4010503@redhat.com \
--to=drepper@redhat.com \
--cc=jakub@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=m.j.w.sipkema@student.tudelft.nl \
--cc=roland@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox