Merge WIP implementation for poll wrapper API

Obtained from:	https://github.com/adamsutton/tvheadend/commit/533a6cc9185396acbee743a8e11ad9b0aec535c6
Fix kqueue parts of the poll wrapper API