Regular files (not pipes or sockets), will always poll() as readable/writable. It's pointless to call poll() on them.
Similarly, if we're doing a synchronous non-cancellable read/write, there's no reason to block in poll() on the fd - just block in read()/write().
I'm writing this patch mainly to make strace on ostree prettier.
Implementation note: the cancellation check is hoisted to the top of the loop, so we still support cancellation for regular files.
Tweaked by Philip Withnall email@example.com to modify nfds handling.
Closes #979 (closed)