Resize the poll array if RLIMIT_NOFILE increases

Allocate the poll array once and re-use it. If the caller increases the
number of file descriptors supported by the process, try to account for
it by re-sizing the poll array.

Caveats:

The poll array will only grow. Because the offset into the array is used
for indexing the fd (similar to how the FD_SET macros work with
select(2)), decreasing the array with existing fd's may result in the
fd's exceeding the size of the array.

Using sysconf(_SC_OPEN_MAX) is not portable. On Linux, it seems to call
getrlimit(RLIMIT_NOFILE).

The value of maxfd is checked in the event loop rather than doing it in
the call to setrlimit because there may be other methods for changing
the limit, for example, using prctl.