Use poll() instead of select() when available

select() has the major drawback that it cannot handle file descriptor that are bigger than 1024. This patch makes use of poll() instead of select() when poll() support is available.