From: Josh Triplett <josh-iaAMLnmF4UmaiuxdJuQwMA@public.gmane.org>
To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: poll(2) and select(2) should document spurious EAGAIN for portable programs
Date: Sun, 23 Aug 2015 00:32:12 -0700 [thread overview]
Message-ID: <20150823073212.GA20753@x> (raw)
On some systems (reported by Jeremy Sequoia as occurring on Darwin),
poll(2) and select(2) can spuriously return EAGAIN if they fail to
allocate kernel-internal resources, rather than ENOMEM as Linux does.
The spec allows this for poll(2):
http://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html says
poll may return EAGAIN if "The allocation of internal data structures
failed but a subsequent request may succeed." The spec for select(2)
at http://pubs.opengroup.org/onlinepubs/9699919799/functions/select.html
doesn't specify EAGAIN, but apparently Darwin can return it in that case
too.
I'd suggest the following text for poll(2)'s NOTES section:
Some other UNIX systems can return EAGAIN if they fail to allocate
kernel-internal resources, rather than ENOMEM as Linux does. The Single
Unix Specification allows this behavior for poll(2). Portable programs
may wish to check for EAGAIN and loop, just as with EINTR.
And the following text for select(2)'s NOTES section:
Some other UNIX systems can return EAGAIN if they fail to allocate
kernel-internal resources, rather than ENOMEM as Linux does. The Single
Unix Specification allows this behavior for poll(2), but not for
select(2); nonetheless, some systems do return EAGAIN from select(2).
Portable programs may wish to check for EAGAIN and loop, just as with
EINTR.
- Josh Triplett
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2015-08-23 7:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-23 7:32 Josh Triplett [this message]
2016-02-04 11:36 ` poll(2) and select(2) should document spurious EAGAIN for portable programs Michael Kerrisk (man-pages)
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=20150823073212.GA20753@x \
--to=josh-iaamlnmf4umaiuxdjuqwma@public.gmane.org \
--cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).