linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* poll(2) and select(2) should document spurious EAGAIN for portable programs
@ 2015-08-23  7:32 Josh Triplett
  2016-02-04 11:36 ` Michael Kerrisk (man-pages)
  0 siblings, 1 reply; 2+ messages in thread
From: Josh Triplett @ 2015-08-23  7:32 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-04 11:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-23  7:32 poll(2) and select(2) should document spurious EAGAIN for portable programs Josh Triplett
2016-02-04 11:36 ` Michael Kerrisk (man-pages)

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).