fd.c: Prefer poll(2) over select(2) for write_ok().
This is easy to do and avoids the old and well-known shortcomings of
select(2). See
http://0pointer.net/blog/file-descriptor-limits.html
for a short discussion, or the references in the log message of commit
e4a403876d2c of the man-pages repository.
The linux poll manpage says:
On some other UNIX systems, poll() can fail with the error EAGAIN if
the system fails to allocate kernel-internal resources, rather than
ENOMEM as Linux does. POSIX permits this behavior. Portable programs
may wish to check for EAGAIN and loop, just as with EINTR.
We do not follow this approach since failing the call in the out of
memory case seems to be the right thing to do while busy looping
without trying to free memory between the calls is not likely to
help. Also, looping on EAGAIN would be inconsistent since in the
OOM case the code would fail on Linux but loop on those other UNIX
systems. To be consistent, one must check for both EAGAIN and ENOMEM.