gunix{input,output}stream: Don't poll() unnecessarily

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 <withnall@endlessm.com> to modify nfds
handling.

GNOME/glib#979
8 jobs for 979-stream-dont-poll in 19 minutes and 26 seconds (queued for 4 seconds)
latest
Status Job ID Name Coverage
  Build
passed #62334
cross-android_api21_arm64

00:01:27

passed #62335
cross-android_api28_arm64

00:01:29

passed #62336
cross-mingw64

00:02:02

passed #62333
fedora-x86_64

00:03:35

failed #62339
freebsd-11 allowed to fail
freebsd-11-x86_64

passed #62337
win32
msys2-mingw32

00:09:11

passed #62338
win32
vs2017-x64

00:05:52

 
  Coverage
passed #62340
coverage

00:01:38

69.8%
 
Name Stage Failure
failed
freebsd-11-x86_64 Build There has been a timeout failure or the job got stuck. Check your timeout limits or try again
No job trace