Re: poll(2) and select(2) should document spurious EAGAIN for portable programs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Josh,


On 23 August 2015 at 09:32, Josh Triplett <josh@xxxxxxxxxxxxxxxx> wrote:
> 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.

I've added text to both pages similar to what you proposed above.

Cheers,

Michael


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux